[go-nuts] Time Zone changes over time & the standard library

2018-09-18 Thread joe . blubaugh
How does Go deal with time zone evolution? It seems likely that the EU will stop changing clocks twice a year, starting next year: https://www.dw.com/en/eu-to-stop-changing-the-clocks-in-2019/a-45495680 How does Go update its time handling systems to accomodate these changes? Will releases be m

Re: [go-nuts] Time

2017-12-21 Thread Shawn Milochik
d should be a time.Duration -- "3.Second" isn't a valid type. If you're trying to set a default value, you can't. You *can* just check in the function whether it equals zero and set it to a default. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group

Re: [go-nuts] Time

2017-12-21 Thread nguyentina
I cannot set a d for func Sleep(). Here is the code: package main import ( "fmt" "time" ) var c = make(chan int) func main() { go send(0, 3) go send(1, 2) go send(2, 1) for i := 0; i < 3; i++ { fmt.Printf("%v %v\n", <-c, time.Now())

Re: [go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-02 Thread ikedamdam
> I don’t see an obvious way of expressing the example hour (15) in a way that would imply “24 hour format, but no zero padding”. I agree with that. It's difficult to decide an example format for 24-hour without zero padding as a part of the standard feature. And that makes me believe the custo

Re: [go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-01 Thread David Collier-Brown
This looks good: if there is a mechanism to align times with language, it should be the implementation of Canadian French (along with things like circiumflex-E) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-01 Thread Jakob Borg
I think this would be difficult to do correctly, given the (very unusual) choice of using an example time as the format string. I don’t see an obvious way of expressing the example hour (15) in a way that would imply “24 hour format, but no zero padding”. //jb On 1 Jul 2017, at 19:01, "ikedam.

Re: [go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-01 Thread ikedamdam
Thanks for the answer. I believe it would be nice if custom formats can be added by developers. Does it make sense to create a pull request for time/format to allow developers add custom formats? Custom formats can be defined if I could extend `nextStdChunk` (extracting `std` from layouts) and

Re: [go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-01 Thread Sam Whited
On Sat, Jul 1, 2017 at 11:01 AM, Sam Whited wrote: > Check out the documentation for the "Format" function: Follow up because I only answered part of the question (my apologies): unfortunately, while Format does allow you to add custom formats, it won't let you change the padding for 24-hour form

Re: [go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-01 Thread Sam Whited
On Sat, Jul 1, 2017 at 2:39 AM, wrote: > Is there a way to extend time/format and add custom formats? Check out the documentation for the "Format" function: https://godoc.org/time#Time.Format —Sam -- You received this message because you are subscribed to the Google Groups "golang-nuts" gro

[go-nuts] time/format: how to add custom formats (24-hour without 0 padding)

2017-07-01 Thread ikedamdam
Hello, I want to format times like this (for Canadian French users): 06:00 -> 6:00 15:00 -> 15:00 So I want format hours in 24-hour clock without 0 padding. Unfortunately, predefined formats in time/format provides only 0 padded hours for 24-hour clock. Is there a way to extend time/format

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread Manlio Perillo
Il giorno giovedì 30 marzo 2017 17:28:47 UTC+2, Ian Lance Taylor ha scritto: > > > [...] > >> But it's not clearly incorrect to write > >> > >> "2006-01-02 or Jan 02, 2006" > >> > > > > I'm probably missing something, but "2006-01-02" is a valid time layout > > string. > > I'm presenting tha

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread Ian Lance Taylor
On Thu, Mar 30, 2017 at 7:49 AM, Manlio Perillo wrote: > Il giorno giovedì 30 marzo 2017 01:21:14 UTC+2, Ian Lance Taylor ha scritto: >> >> On Wed, Mar 29, 2017 at 2:29 PM, Manlio Perillo >> wrote: >> > Il giorno mercoledì 29 marzo 2017 23:18:09 UTC+2, Ian Lance Taylor ha >> > scritto: >> >> >> >

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread David Collier-Brown
I think he said "02/02/2006", and got two day-numbers instead of a day and a month. --dave On Thursday, March 30, 2017 at 10:49:29 AM UTC-4, Manlio Perillo wrote: > > Il giorno giovedì 30 marzo 2017 01:21:14 UTC+2, Ian Lance Taylor ha > scritto: >> >> On Wed, Mar 29, 2017 at 2:29 PM, Manlio Per

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread Manlio Perillo
Il giorno giovedì 30 marzo 2017 01:21:14 UTC+2, Ian Lance Taylor ha scritto: > > On Wed, Mar 29, 2017 at 2:29 PM, Manlio Perillo > > wrote: > > Il giorno mercoledì 29 marzo 2017 23:18:09 UTC+2, Ian Lance Taylor ha > > scritto: > >> > >> On Wed, Mar 29, 2017 at 2:03 PM, Manlio Perillo > >> wr

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread Manlio Perillo
Certainly this is a bug that can be found with unit test, however catching a bug early is always better, if this is possible. Manlio Il giorno giovedì 30 marzo 2017 13:18:35 UTC+2, rog ha scritto: > > Isn't this the kind of thing we write tests for? > > On 29 Mar 2017 22:03, "Manlio Perillo"

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread David Collier-Brown
>From your described implementation, I assume you're asking for something like As a programmer, if I ask for a date with month twice, I wish to revieve a warning" If so, it would complain if I asked to print something like "01/01/2017 (1 Jan 2017)" --dave -- You received this message be

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread David Collier-Brown
>From your described implementation, I assume youre asking for On Wednesday, March 29, 2017 at 5:29:19 PM UTC-4, Manlio Perillo wrote: > > Il giorno mercoledì 29 marzo 2017 23:18:09 UTC+2, Ian Lance Taylor ha > scritto: >> >> On Wed, Mar 29, 2017 at 2:03 PM, Manlio Perillo >> wrote: >> > In

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-30 Thread roger peppe
Isn't this the kind of thing we write tests for? On 29 Mar 2017 22:03, "Manlio Perillo" wrote: > In a program I have a function that formats the time in Italian date > format: dd/mm/, but, due to an oversight, I wrote the layout string as > "02/02/2006", instead of "02/01/2006". > This cause

RE: [go-nuts] time: error prone implementation of Time.Format

2017-03-29 Thread John Souvestre
@googlegroups.com] On Behalf Of Ian Lance Taylor Sent: 2017 March 29, Wed 18:21 To: Manlio Perillo Cc: golang-nuts Subject: Re: [go-nuts] time: error prone implementation of Time.Format On Wed, Mar 29, 2017 at 2:29 PM, Manlio Perillo wrote: > Il giorno mercoled� 29 marzo 2017 23:18:09 UTC+2, Ian La

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-29 Thread Ian Lance Taylor
On Wed, Mar 29, 2017 at 2:29 PM, Manlio Perillo wrote: > Il giorno mercoledì 29 marzo 2017 23:18:09 UTC+2, Ian Lance Taylor ha > scritto: >> >> On Wed, Mar 29, 2017 at 2:03 PM, Manlio Perillo >> wrote: >> > In a program I have a function that formats the time in Italian date >> > format: >> > dd/

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-29 Thread Manlio Perillo
Il giorno mercoledì 29 marzo 2017 23:18:09 UTC+2, Ian Lance Taylor ha scritto: > > On Wed, Mar 29, 2017 at 2:03 PM, Manlio Perillo > > wrote: > > In a program I have a function that formats the time in Italian date > format: > > dd/mm/, but, due to an oversight, I wrote the layout string a

Re: [go-nuts] time: error prone implementation of Time.Format

2017-03-29 Thread Ian Lance Taylor
On Wed, Mar 29, 2017 at 2:03 PM, Manlio Perillo wrote: > In a program I have a function that formats the time in Italian date format: > dd/mm/, but, due to an oversight, I wrote the layout string as > "02/02/2006", instead of "02/01/2006". > This caused all the dates to be incorrectly formatte

[go-nuts] time: error prone implementation of Time.Format

2017-03-29 Thread Manlio Perillo
In a program I have a function that formats the time in Italian date format: dd/mm/, but, due to an oversight, I wrote the layout string as "02/02/2006", instead of "02/01/2006". This caused all the dates to be incorrectly formatted. IMHO, this is a nasty behavior. The layout is clearly inc

[go-nuts] time sub negative

2016-11-25 Thread Dave Cheney
You might want to try eTime.Sub(sTime) which returns a time.Duration which can print itself. Which operating system are you using? Which version of Go are you using? Are you running in a virtual machine? -- You received this message because you are subscribed to the Google Groups "golang-nut

[go-nuts] time sub negative

2016-11-24 Thread Xu Lei
.. sTime := time.Now().Nanosecond() defer func() { eTime := time.Now().Nanosecond() debug("Success for ", qname, "for", (eTime-sTime)/100) }() .. i got negative value for (eTime - sTime) when defer function calls is there any thing

[go-nuts] time representation to use with javascript

2016-10-10 Thread bsr
Hello, I store all time values in UTC, and since it runs on google app engine, the precision might be in microseconds. https://github.com/golang/appengine/blob/master/datastore/save.go#L21 I want to display this time in client side with moment.js. But, javascript doesn't support int64, so how s

Re: [go-nuts] time: time.Parse's Location

2016-08-24 Thread Matt Harden
Sorry, that's time.Local = time.UTC. On Wed, Aug 24, 2016 at 8:26 PM Matt Harden wrote: > Note that ParseInLocation(..., time.UTC) should give you the same behavior > in both test scenarios. If you have to use Parse, you can set time.Location > = time.UTC, with the same result. > > On Wed, Aug 2

Re: [go-nuts] time: time.Parse's Location

2016-08-24 Thread Matt Harden
Note that ParseInLocation(..., time.UTC) should give you the same behavior in both test scenarios. If you have to use Parse, you can set time.Location = time.UTC, with the same result. On Wed, Aug 24, 2016 at 10:05 AM wrote: > Thanks for the response! > > On Wednesday, August 24, 2016 at 7:16:00

Re: [go-nuts] time: time.Parse's Location

2016-08-24 Thread nrjones8
Thanks for the response! On Wednesday, August 24, 2016 at 7:16:00 AM UTC-7, Ian Lance Taylor wrote: > > On Tue, Aug 23, 2016 at 10:58 PM, > > wrote: > > > > I was running into issues with comparing time.Time objects in a unit > test > > that would pass on a CI server, but fail on my local ma

Re: [go-nuts] time: time.Parse's Location

2016-08-24 Thread Ian Lance Taylor
On Tue, Aug 23, 2016 at 10:58 PM, wrote: > > I was running into issues with comparing time.Time objects in a unit test > that would pass on a CI server, but fail on my local machine. I wanted to > see if anyone could double check my understanding of how `time.Parse` treats > locations (I posted o

[go-nuts] time: time.Parse's Location

2016-08-24 Thread nrjones8
I was running into issues with comparing time.Time objects in a unit test that would pass on a CI server, but fail on my local machine. I wanted to see if anyone could double check my understanding of how `time.Parse` treats locations (I posted on Stack Overflow