|
Boost Users : |
From: Chris Weed (chrisweed_at_[hidden])
Date: 2006-09-20 19:07:29
Try this example:
Local to UTC Conversion and vice versa:
http://tinyurl.com/mloh3
Chris
On 9/20/06, Andreas Ntaflos <daff_at_[hidden]> wrote:
> Hello boost-users,
>
> I am quite new to Boost and this is my first post to this list. My
> problem is quite similar to one posted to this list two years ago [1].
> Since there don't seem to be any follow-ups to that message I hope to
> find an answer by posting here.
>
> A program of mine reads a Unix timestamp from a database (the field is
> simply of type NUMERIC(10,0), written to by PHP's time() [2] function)
> into a `std::time_t time' object, holding the seconds since the epoch,
> in UTC. No time zone adjustments are applied as far as I understood.
>
> I need to convert this time_t to a ptime (or any other kind of
> printable, readable string) with time zone adjustments applied.
> Converting with the from_time_t() method works fine, except that the
> resulting date and time are still in UTC.
>
> What would be the most simple way to have the time_t converted to a
> ptime with local time zone adjustments? The time zone could be any but
> it would suffice if it is the one the computer running the program is
> in. I could even hardcode the time zone into the program.
>
> Hopefully I made enough sense to have someone knowing help me out. RTFM
> answers are most welcome, although I have read much of the docs on the
> date_time library on the Boost homepage. So if possible please point me
> to the section in the that is relevant to my problem.
>
> If this is not possible with Boost are there any other functions I could
> use, probably from the standard library?
>
> Thanks a lot in advance!
>
> Andreas
>
> [1] Very long Google cache link:
> http://www.google.com/search?q=cache:s-MYu63Ev8UJ:lists.boost.org/MailArchives/boost-users/msg07310.php+convert+time_t+to+local+time+with+time+zone+site:boost.org&hl=en&lr=&client=firefox&strip=1
> [2] http://www.php.net/manual/en/function.time.php
> --
> Andreas "daff" Ntaflos
> Vienna, Austria
>
> GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC 7E65 397C E2A8 090C A9B4
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net