Re: [go-nuts] time.Truncate unexpected results in non-hour aligned timezones

2022-08-24 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-08-23 at 23:07 -0700, Mine GO BOOM wrote:
> Our system recently experienced a bug because of the surprise that
> sits (documented) inside of time.Truncate():
>
> """
> Truncate operates on the time as an absolute duration since the zero
> time; it does not operate on the presentation form of the time. Thus,
> Truncate(Hour) may return a time with a non-zero minute, depending on
> the time's Location.
> """
>
> Example of this surprise: https://go.dev/play/p/hZEHhj8QTZs
> currentTime: 2021-07-28 06:03:00 +0545 +0545
> truncated to one hour: 2021-07-28 05:45:00 +0545 +0545
> truncateTimezoneSensitive: 2021-07-28 06:00:00 +0545 +0545
>
> I see that time: could use a "truncate in timezone" feature was
> closed a long time ago with the comment: "The vast majority of
> truncation/rounding of times happens on units of 1 hour or smaller,
> and those are typically not sensitive to time zone." I do agree that
> most rounding/truncating does work on one hour or less (we sure do),
> but I'd say that it should be sensitive to time zones. The over a
> billion people in India (GMT +5:30) would agree with that, as they
> are the ones that reported the bug in our system.
>
> I would like to suggest this for an addition to the Go says
> WAT? collection.
>
> Can someone re-open the bug for further discussion?

I would recommend that you open a new issue rather than requesting the
old one be reopened. If you do, you should provide any new information
that is not discussed in the old issue that supports the need of the
feature.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/bfd86b65f35b94e4cc49bf67f788cb2d00f5ba55.camel%40kortschak.io.


[go-nuts] time.Truncate unexpected results in non-hour aligned timezones

2022-08-24 Thread Mine GO BOOM
Our system recently experienced a bug because of the surprise that sits 
(documented) inside of time.Truncate() 
:

"""
Truncate operates on the time as an absolute duration since the zero time; 
it does not operate on the presentation form of the time. Thus, 
Truncate(Hour) may return a time with a non-zero minute, depending on the 
time's Location.
"""

Example of this surprise: https://go.dev/play/p/hZEHhj8QTZs
currentTime: 2021-07-28 06:03:00 +0545 +0545
truncated to one hour: 2021-07-28 05:45:00 +0545 +0545
truncateTimezoneSensitive: 2021-07-28 06:00:00 +0545 +0545

I see that time: could use a "truncate in timezone" feature 
 was closed a long time ago with 
the comment: "The vast majority of truncation/rounding of times happens on 
units of 1 hour or smaller, and those are typically not sensitive to time 
zone." I do agree that most rounding/truncating does work on one hour or 
less (we sure do), but I'd say that it should be sensitive to time zones. 
The over a billion people in India (GMT +5:30) would agree with that, as 
they are the ones that reported the bug in our system.

I would like to suggest this for an addition to the Go says WAT? 

 collection.

Can someone re-open the bug for further discussion?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/304a1365-9d9e-46f2-92bd-349a60182f5en%40googlegroups.com.