Timezone handling

Sabra Crolleton sabra.crolleton at gmail.com
Wed Jul 24 04:26:16 UTC 2013


I use the local-time package with encode-timestamp to create the timestamp
and just put that into the database.

Function: local-time:encode-timestamp nsec sec minute hour day month year
&key timezone offset into

Returns a new timestamp instance corresponding to the specified time
elements. The offset is the number of seconds offset from UTC of the
locale. If offset is not specified, the offset will be guessed from the
timezone. If a timestamp is passed as the into argument, its value will be
set and that timestamp will be returned. Otherwise, a new timestamp is
created.

Hope that helps.

Sabra



On Tue, Jul 23, 2013 at 3:39 PM, Julien Danjou <julien at danjou.info> wrote:

> Hi there,
>
> I'm struggling with timezone handling in Postmodern. I'm using timestamp
> with time zone column types, and I'm looking for the correct way to feed
> postmodern such information on insert. Basically, I don't see any class
> that would fit. I've tried to grep through the code but didn't find much
> about timestamp/timezone handling.
>
> Concretely, I'm having UTC timestamp that I want to insert into those
> timestamp-with-time-zone columns, but I don't know how to tell
> Postmodern that it should postfix them with something like +00 so PG
> understand it should not default them to its default timezone.
>
> On the same topic, I thought that one easy solution would be to set the
> session timezone to UTC. It's easy enough to come with a macro doing a
> SET TIMEZONE='UTC' before each request, but honestly, I'd like to avoid
> that and do it only at connection time.
> Now, I've read through cl-postgres code, and I was hoping being able to
> plug my code at connection time, but it seems everything is defined as
> function and not as method, which seems weird to me, and not really
> pluggable in the end.
>
> Any hint appreciated!
>
> Cheers,
> --
> Julien Danjou
> ;; Free Software hacker ; freelance consultant
> ;; http://julien.danjou.info
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20130723/1b4c1b5a/attachment.html>


More information about the postmodern-devel mailing list