Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread Dmitry Pavlov




That was more intended as a rant about things that drive me batty than 
actual instruction -- I hope it didn't come across as patronizing.

No, not at all.

One of the things that surprised me the most is that prior to 1925, 
astronomers kept timestamps of their observations where day started at 
noon, not at midnight---for keeping the day constant through the 
observation session.


By the way, a question to Racket developers: is Racket ready for year 2038?

Best regards,

Dmitry

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread Robby Findler
Date rants are the best :)

http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time

Robby

On Thu, Oct 20, 2016 at 1:06 PM, David Storrs  wrote:
> That was more intended as a rant about things that drive me batty than
> actual instruction -- I hope it didn't come across as patronizing.
>
> On Thu, Oct 20, 2016 at 12:32 PM, Dmitry Pavlov  wrote:
>>
>> David,
>>
>> Yes, I deal with most of this at work, except daylight savings.
>> (Timestamps in astronomical observations are predominantly in UTC or rarely
>> TT/TDB, I never saw local time.)
>>
>> Best regards,
>>
>> Dmitry
>>
>>
>>
>> On 10/20/2016 07:26 PM, David Storrs wrote:
>>
>> Also be aware that once you start getting into date math you need to deal
>> with:
>>
>> *) Minutes that might have 61 seconds in them.  Yes, hh:mm:60 is a real
>> time.
>>
>> *) Hours that don't exist.
>>
>> *) Hours that happen twice in the same day.
>>
>> *) Februaries that have 28 or 29 days on a weird schedule.  (If the year
>> is divisible by 4, unless it's divisible by 100, unless it's divisible by
>> 400.)
>>
>> *) Two weeks that didn't exist due to calendars switching over.
>>
>> *) The modern calendar being adopted at different points in different
>> countries.  Greece didn't start using it until 1923.
>>
>> On Thu, Oct 20, 2016 at 12:13 PM, Matthew Flatt 
>> wrote:
>>>
>>> Did you timezone use daylight saving in 1996?
>>>
>>> In U.S. timezones, March (it used to be April) has a 1-hour hole due to
>>> the switch to daylight saving time, where the clock skips forward from
>>> 1:59am to 3:00am. For example, 2:47:59am on March 13, 2016 really did
>>> not exist in my timezone.
>>>
>>> At Thu, 20 Oct 2016 19:05:38 +0300, Dmitry Pavlov wrote:
>>> > Hello,
>>> >
>>> > The surprise of the day for me is date->seconds
>>> > rejecting a particular time on a particular date.
>>> >
>>> > (date->seconds (date 59 47 2 31 3 1996 0 0 #f 0))
>>> >
>>> > This should be 1996, March 31, 02:47:59 am, correct?
>>> >
>>> >
>>> > It reports the following error:
>>> >
>>> > find-seconds: non-existent date
>>> >wanted: (59 47 2 31 3 1996)
>>> >nearest below: 828226799 is (59 59 1 31 3 1996)
>>> >nearest above: 828226800 is (0 0 3 31 3 1996)
>>> >context...:
>>> > /opt/racket/collects/racket/date.rkt:234:0: date->seconds
>>> >
>>> > /opt/racket/collects/racket/contract/private/arrow-val-first.rkt:306:25
>>> > /opt/racket/collects/racket/private/misc.rkt:88:7
>>> >
>>> >  From the message, I can suppose that it misses a whole hour inside.
>>> >
>>> > What can be done?
>>> >
>>> > This is Racket 6.6 on Linux.
>>> >
>>> >
>>> > Best regards,
>>> >
>>> > Dmitry
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "Racket Users" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> > an
>>> > email to racket-users+unsubscr...@googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to racket-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread David Storrs
That was more intended as a rant about things that drive me batty than
actual instruction -- I hope it didn't come across as patronizing.

On Thu, Oct 20, 2016 at 12:32 PM, Dmitry Pavlov  wrote:

> David,
>
> Yes, I deal with most of this at work, except daylight savings.
> (Timestamps in astronomical observations are predominantly in UTC or rarely
> TT/TDB, I never saw local time.)
>
> Best regards,
>
> Dmitry
>
>
>
> On 10/20/2016 07:26 PM, David Storrs wrote:
>
> Also be aware that once you start getting into date math you need to deal
> with:
>
> *) Minutes that might have 61 seconds in them.  Yes, hh:mm:60 is a real
> time.
>
> *) Hours that don't exist.
>
> *) Hours that happen twice in the same day.
>
> *) Februaries that have 28 or 29 days on a weird schedule.  (If the year
> is divisible by 4, unless it's divisible by 100, unless it's divisible by
> 400.)
>
> *) Two weeks that didn't exist due to calendars switching over.
>
> *) The modern calendar being adopted at different points in different
> countries.  Greece didn't start using it until 1923.
>
> On Thu, Oct 20, 2016 at 12:13 PM, Matthew Flatt 
> wrote:
>
>> Did you timezone use daylight saving in 1996?
>>
>> In U.S. timezones, March (it used to be April) has a 1-hour hole due to
>> the switch to daylight saving time, where the clock skips forward from
>> 1:59am to 3:00am. For example, 2:47:59am on March 13, 2016 really did
>> not exist in my timezone.
>>
>> At Thu, 20 Oct 2016 19:05:38 +0300, Dmitry Pavlov wrote:
>> > Hello,
>> >
>> > The surprise of the day for me is date->seconds
>> > rejecting a particular time on a particular date.
>> >
>> > (date->seconds (date 59 47 2 31 3 1996 0 0 #f 0))
>> >
>> > This should be 1996, March 31, 02:47:59 am, correct?
>> >
>> >
>> > It reports the following error:
>> >
>> > find-seconds: non-existent date
>> >wanted: (59 47 2 31 3 1996)
>> >nearest below: 828226799 is (59 59 1 31 3 1996)
>> >nearest above: 828226800 is (0 0 3 31 3 1996)
>> >context...:
>> > /opt/racket/collects/racket/date.rkt:234:0: date->seconds
>> > /opt/racket/collects/racket/contract/private/arrow-val-firs
>> t.rkt:306:25
>> > /opt/racket/collects/racket/private/misc.rkt:88:7
>> >
>> >  From the message, I can suppose that it misses a whole hour inside.
>> >
>> > What can be done?
>> >
>> > This is Racket 6.6 on Linux.
>> >
>> >
>> > Best regards,
>> >
>> > Dmitry
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread Dmitry Pavlov

David,

Yes, I deal with most of this at work, except daylight savings. 
(Timestamps in astronomical observations are predominantly in UTC or 
rarely TT/TDB, I never saw local time.)


Best regards,

Dmitry


On 10/20/2016 07:26 PM, David Storrs wrote:
Also be aware that once you start getting into date math you need to 
deal with:


*) Minutes that might have 61 seconds in them.  Yes, hh:mm:60 is a 
real time.


*) Hours that don't exist.

*) Hours that happen twice in the same day.

*) Februaries that have 28 or 29 days on a weird schedule. (If the 
year is divisible by 4, unless it's divisible by 100, unless it's 
divisible by 400.)


*) Two weeks that didn't exist due to calendars switching over.

*) The modern calendar being adopted at different points in different 
countries.  Greece didn't start using it until 1923.


On Thu, Oct 20, 2016 at 12:13 PM, Matthew Flatt > wrote:


Did you timezone use daylight saving in 1996?

In U.S. timezones, March (it used to be April) has a 1-hour hole
due to
the switch to daylight saving time, where the clock skips forward from
1:59am to 3:00am. For example, 2:47:59am on March 13, 2016 really did
not exist in my timezone.

At Thu, 20 Oct 2016 19:05:38 +0300, Dmitry Pavlov wrote:
> Hello,
>
> The surprise of the day for me is date->seconds
> rejecting a particular time on a particular date.
>
> (date->seconds (date 59 47 2 31 3 1996 0 0 #f 0))
>
> This should be 1996, March 31, 02:47:59 am, correct?
>
>
> It reports the following error:
>
> find-seconds: non-existent date
>wanted: (59 47 2 31 3 1996)
>nearest below: 828226799 is (59 59 1 31 3 1996)
>nearest above: 828226800 is (0 0 3 31 3 1996)
>context...:
> /opt/racket/collects/racket/date.rkt:234:0: date->seconds
>   
 /opt/racket/collects/racket/contract/private/arrow-val-first.rkt:306:25

> /opt/racket/collects/racket/private/misc.rkt:88:7
>
>  From the message, I can suppose that it misses a whole hour inside.
>
> What can be done?
>
> This is Racket 6.6 on Linux.
>
>
> Best regards,
>
> Dmitry
>
> --
> You received this message because you are subscribed to the
Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from
it, send an
> email to racket-users+unsubscr...@googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout
.

--
You received this message because you are subscribed to the Google
Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to racket-users+unsubscr...@googlegroups.com
.
For more options, visit https://groups.google.com/d/optout
.




--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread David Storrs
Also be aware that once you start getting into date math you need to deal
with:

*) Minutes that might have 61 seconds in them.  Yes, hh:mm:60 is a real
time.

*) Hours that don't exist.

*) Hours that happen twice in the same day.

*) Februaries that have 28 or 29 days on a weird schedule.  (If the year is
divisible by 4, unless it's divisible by 100, unless it's divisible by 400.)

*) Two weeks that didn't exist due to calendars switching over.

*) The modern calendar being adopted at different points in different
countries.  Greece didn't start using it until 1923.

On Thu, Oct 20, 2016 at 12:13 PM, Matthew Flatt  wrote:

> Did you timezone use daylight saving in 1996?
>
> In U.S. timezones, March (it used to be April) has a 1-hour hole due to
> the switch to daylight saving time, where the clock skips forward from
> 1:59am to 3:00am. For example, 2:47:59am on March 13, 2016 really did
> not exist in my timezone.
>
> At Thu, 20 Oct 2016 19:05:38 +0300, Dmitry Pavlov wrote:
> > Hello,
> >
> > The surprise of the day for me is date->seconds
> > rejecting a particular time on a particular date.
> >
> > (date->seconds (date 59 47 2 31 3 1996 0 0 #f 0))
> >
> > This should be 1996, March 31, 02:47:59 am, correct?
> >
> >
> > It reports the following error:
> >
> > find-seconds: non-existent date
> >wanted: (59 47 2 31 3 1996)
> >nearest below: 828226799 is (59 59 1 31 3 1996)
> >nearest above: 828226800 is (0 0 3 31 3 1996)
> >context...:
> > /opt/racket/collects/racket/date.rkt:234:0: date->seconds
> > /opt/racket/collects/racket/contract/private/arrow-val-
> first.rkt:306:25
> > /opt/racket/collects/racket/private/misc.rkt:88:7
> >
> >  From the message, I can suppose that it misses a whole hour inside.
> >
> > What can be done?
> >
> > This is Racket 6.6 on Linux.
> >
> >
> > Best regards,
> >
> > Dmitry
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread Dmitry Pavlov

Matthew,



Did you timezone use daylight saving in 1996?



Oh, right.

I need UTC date and time; I assumed it is UTC since I passed #f for dst? 
and 0 for time-zone-offset in (date). I missed the local-time? flag in 
date->seconds, which is true by default.


So the corrected version of my code
(date->seconds (date 59 47 2 31 3 1996 0 0 #f 0) #f)
works fine.

Thank you for such a fast response.

Best regards,

Dmitry

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] date->seconds complaining about a supposedly non-existent date

2016-10-20 Thread Matthew Flatt
Did you timezone use daylight saving in 1996?

In U.S. timezones, March (it used to be April) has a 1-hour hole due to
the switch to daylight saving time, where the clock skips forward from
1:59am to 3:00am. For example, 2:47:59am on March 13, 2016 really did
not exist in my timezone.

At Thu, 20 Oct 2016 19:05:38 +0300, Dmitry Pavlov wrote:
> Hello,
> 
> The surprise of the day for me is date->seconds
> rejecting a particular time on a particular date.
> 
> (date->seconds (date 59 47 2 31 3 1996 0 0 #f 0))
> 
> This should be 1996, March 31, 02:47:59 am, correct?
> 
> 
> It reports the following error:
> 
> find-seconds: non-existent date
>wanted: (59 47 2 31 3 1996)
>nearest below: 828226799 is (59 59 1 31 3 1996)
>nearest above: 828226800 is (0 0 3 31 3 1996)
>context...:
> /opt/racket/collects/racket/date.rkt:234:0: date->seconds
> /opt/racket/collects/racket/contract/private/arrow-val-first.rkt:306:25
> /opt/racket/collects/racket/private/misc.rkt:88:7
> 
>  From the message, I can suppose that it misses a whole hour inside.
> 
> What can be done?
> 
> This is Racket 6.6 on Linux.
> 
> 
> Best regards,
> 
> Dmitry
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.