Re: to_timestamp overloaded to convert from Unix epoch

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: to_timestamp overloaded to convert from Unix epoch
Date: 2004-08-14 09:50:49
Message-ID: 411DE079.1070207@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

I wonder...

Maybe you don't need to override to_timestamp, and you can just add a
new code to the format string that to_timestamp understands, ie 'e' or
something or 'u' that means 'unix timestamp'?

Chris

Michael Glaesemann wrote:

> Please find attached a patch (diff -c against cvs HEAD) to add a
> function that accepts a double precision argument assumed to be a Unix
> epoch timestamp and returns timestamp with time zone, and accompanying
> documentation.
>
> Usage:
>
> test=# select to_timestamp(200120400);
> to_timestamp
> ------------------------
> 1976-05-05 14:00:00+09
> (1 row)
>
> If regression tests are required, I will produce some. I'd appreciate
> any pointers as to what to look for, as they would be my first attempt
> at writing regression tests.
>
> Regards
>
> Michael Glaesemann
> grzm myrealbox com
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2004-08-14 12:52:13 Re: [Fwd: Re: [pgsql-hackers-win32] Import from Linux to
Previous Message Simon@2ndquadrant.com 2004-08-14 09:39:23 Re: NOT LOGGED options (was Point in Time Recovery )