epoch to show millseconds 
Author Message
 epoch to show millseconds


Quote:

> > how do I make it accurate up to milliseconds value?

> You don't.  current_timestamp depends on the time() system call,
> which only returns a number accurate to one second.

Well, I managed to have a workaround for it by:
punkdb=# select date_part('epoch', current_timestamp) ||
trim(to_char(date_part('millisecond', timeofday()::timestamp),'999'));

   ?column?
--------------
 995418886281
(1 row)

Quote:
> There is a higher-precision current time function in 7.1, but I
> forget the details ... see the docs.  IIRC it existed but was
> buggy in 7.0, so you'll need to update.

This is on 7.0.3

Quote:
> regards, tom lane

My sole purpose is to generate a primary key, w/c I believe is sufficient and
unique enough to avoid double records (or errors that an existing record of
the same epoch exist, if it's only up to the second).

Thanks, for the response though, I really appreciate it ;-)

cheers
mars
--
"I gained nothing at all from Supreme Enlightenment, and for that very
reason it is called Supreme Enlightenment."
                -- Gotama Buddha

---------------------------(end of broadcast)---------------------------



Sat, 10 Jan 2004 03:27:54 GMT
 epoch to show millseconds

Remember that epoch is a number of seconds, plain and simple so you can't
get milliseconds from epoch, unless you wanted to carry zeros out to
infinity :-)

Good luck!

-Mitch

Quote:
----- Original Message -----



Sent: Tuesday, July 17, 2001 9:22 PM
Subject: [GENERAL] Re: epoch to show millseconds



> > > how do I make it accurate up to milliseconds value?

> > You don't.  current_timestamp depends on the time() system call,
> > which only returns a number accurate to one second.

> Well, I managed to have a workaround for it by:
> punkdb=# select date_part('epoch', current_timestamp) ||
> trim(to_char(date_part('millisecond', timeofday()::timestamp),'999'));

>    ?column?
> --------------
>  995418886281
> (1 row)

> > There is a higher-precision current time function in 7.1, but I
> > forget the details ... see the docs.  IIRC it existed but was
> > buggy in 7.0, so you'll need to update.

> This is on 7.0.3

> > regards, tom lane

> My sole purpose is to generate a primary key, w/c I believe is sufficient
and
> unique enough to avoid double records (or errors that an existing record
of
> the same epoch exist, if it's only up to the second).

> Thanks, for the response though, I really appreciate it ;-)

> cheers
> mars
> --
> "I gained nothing at all from Supreme Enlightenment, and for that very
> reason it is called Supreme Enlightenment."
> -- Gotama Buddha

> ---------------------------(end of broadcast)---------------------------

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Sat, 10 Jan 2004 03:43:44 GMT
 epoch to show millseconds

Quote:

> My sole purpose is to generate a primary key, w/c I believe is sufficient and
> unique enough to avoid double records

What's wrong with a SERIAL then?

--

APL Financial Services          http://village.albourne.com
Nicosia, Cyprus                 phone: +357-2-755750

"It is more complicated than you think"
                -- The Eighth Networking Truth from RFC 1925



Sat, 10 Jan 2004 16:55:08 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. time in millseconds

2. Do we still need PowerPC-specific timestamp_is_current/epoch?

3. convert from datepart('epoch', now()) to Date / time

4. Q:Signal 10 sent to Sybase (by Epoch ?)

5. Convert DATE to seconds since epoch

6. epoch <-> timestamp

7. Getting epoch in dates

8. reverse of extract epoch?

9. epoch <-> timestamp

10. EPOCH in FOXPRO

11. Epoch Backup for RDBMS

12. Continue: Signal 10 sent to Sybase (by Epoch ?)


 
Powered by phpBB® Forum Software