Boost logo

Boost :

Subject: [boost] [DateTime] Converting ptime to real POSIX Time
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-08-17 04:46:53


Hello,

I want to provide some integration between boost::posix_time::ptime and
boost::locale::date_time - make transparent conversion between two.

I have following point I either miss in ptime design or it has design flaws:

1. POSIX Time (see http://en.wikipedia.org/wiki/Unix_time)
   is always considered Time in seconds from 1970-JAN-1 00:00:00 UTC
   not including leap seconds.

   However ptime can be constructed from "local_time" which is totally
   contradicts a well known definition of POSIX time.

2. I can't find any way to convert it to "number" POSIX time. I can convert it
   to time_t and from time_t but if I need a better accuracy -milli-seconds,
nano-seconds etc.
   it seems to be impossible according to docs.

   How can I convert it to more accurate representation?

   Is there any way to get a notice about how ptime was created, with
   universal time scale or local time scale, also I there a way to
   get UTC POSIX time from ptime even if it was created from local time.

Artyom

      


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk