POV-Ray : Newsgroups : povray.general : Anyone use datetime? : Re: Anyone use datetime? Server Time
29 Apr 2024 17:46:28 EDT (-0400)
  Re: Anyone use datetime?  
From: Le Forgeron
Date: 21 Nov 2014 00:22:11
Message: <546ecc03$1@news.povray.org>
On 20/11/2014 23:47, Leroy wrote:
> While I was waiting I played with the 'now' in datetime() and figured my
>  NOW is .25 to big so I subtracted it and works find :)
>       datetime(now-.25,String format)
> While playing I found that all the format options in C++ work as
> expected, except %I and %H.(both hour formats where 6 hour off)
>  You said that datetime uses strftime(), after getting the LC_TIME
> environment variable from my environment. Perhaps that is what's off or
> the bios. Looks like I need to play some more.

Looking at your message's header, I see that you are in -0600 timezone.
That might explain the .25 difference




For the programmers that might want to look at it:


Computation of now is done as follow:

boost::posix_time::ptime y2k(boost::gregorian::date(2000,1,1));
						boost::posix_time::ptime
now(boost::posix_time::microsec_clock::universal_time());

Val = (now-y2k).total_microseconds() * (1.0e-6) / (24*60*60);

It's the number of days since 2000-01-01 (fractional part as the time in
day)




datetime adjust the value to convert back to the number of seconds since
1970-01-01 00:00:00 ( it's rounded to the nearest second )

From that number, the date is rebuild via:

std::tm t =
boost::posix_time::to_tm(boost::posix_time::from_time_t(timestamp));

vlen = strftime(val, PARSE_NOW_VAL_LENGTH, FormatStr, &t);


-- 
IQ of crossposters with FU: 100 / (number of groups)
IQ of crossposters without FU: 100 / (1 + number of groups)
IQ of multiposters: 100 / ( (number of groups) * (number of groups))


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.