[racket] srfi/19 UTC time

From: Lewis (lewis1711 at gmail.com)
Date: Wed May 22 01:05:04 EDT 2013

Thanks! I didn't know you could construct dates like that.

According to the docs, the #f argument should give UTC. Unfortunately
on my machine it gives

(date* 0 0 12 22 5 2013 3 141 #f 43200 0 "NZST")

Which is local time for me. Perhaps this is a bug?

On 22/05/2013, John Clements <clements at brinckerhoff.org> wrote:
>
> On May 21, 2013, at 8:51 PM, Lewis wrote:
>
>> When I use string->date in srfi/19, it defaults to my local time zone.
>> I see from the documentation that one can use "~z" to denote the "time
>> zone in RFC-822 style". A quick google of RFC-822 suggests "UT" is the
>> correct abbreviation for UTC.
>>
>> However
>>
>> Welcome to Racket v5.3.4.
>>> (require srfi/19)
>>> (string->date "22/05/13/UT" "~d/~m/~y/~z")
>> string->date: TIME-ERROR type bad-date-format-string: "~d/~m/~y/~z"
>>  context...:
>>   /usr/lib/racket/collects/srfi/19/time.rkt:1532:0: tm:string->date
>>   /usr/lib/racket/collects/srfi/19/time.rkt:1569:0: string->date
>>   /usr/lib/racket/collects/racket/private/misc.rkt:87:7
>>
>> So in short: how - given the day, month and year - can I construct a
>> date object that's in UTC?
>
> How important is it to you to use srfi/19?
>
> The program below produces the date that you're looking for, if I understand
> correctly:
>
>
> #lang racket
>
> (require racket/date)
>
> (seconds->date (find-seconds 0 0 0 22 05 2013 #f))
>
>
>

Posted on the users mailing list.