POV-Ray : Newsgroups : povray.general : Anyone use datetime? Server Time
29 Apr 2024 18:28:00 EDT (-0400)
  Anyone use datetime? (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: Le Forgeron
Subject: Re: Anyone use datetime?
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

From: Leroy
Subject: Re: Anyone use datetime?
Date: 22 Nov 2014 12:46:41
Message: <5470cc01@news.povray.org>
Your right about the time zone. I check out every thing you said. No luck.

So is the problem my XP or is it in POV 3.7?


Post a reply to this message

From: Leroy
Subject: Re: Anyone use datetime?
Date: 22 Nov 2014 13:07:44
Message: <5470d0f0$1@news.povray.org>
Nekar Xenos wrote:
>> On Thu, 20 Nov 2014 22:16:24 +0200, Le_Forgeron <jgr### [at] freefr> 
>> wrote:
> 
>> Iso 8601 is YEAR-Month-Day (the '-' might be omitted in
>> non-extended format)
>>
>> There is only one format for date, Iso 8601. All other formats are 
>> doomed.
> 
> Agreed. All other formats don't make sense.
> 
> ---Nekar Xenos-

I disagree. The format you use should be job specific and a matter of 
taste. The information you want to convey and to whom is important to 
what format you use. Degrees of Freedom. That's what I like!


Post a reply to this message

From: Nekar Xenos
Subject: Re: Anyone use datetime?
Date: 22 Nov 2014 13:58:18
Message: <op.xpqpnb1oufxv4h@xena.home>
On Sat, 22 Nov 2014 20:04:56 +0200, Leroy <lrw### [at] joplincom> wrote:

> Nekar Xenos wrote:
>>> On Thu, 20 Nov 2014 22:16:24 +0200, Le_Forgeron <jgr### [at] freefr>  
>>> wrote:
>>
>>> Iso 8601 is YEAR-Month-Day (the '-' might be omitted in
>>> non-extended format)
>>>
>>> There is only one format for date, Iso 8601. All other formats are  
>>> doomed.
>>  Agreed. All other formats don't make sense.
>>  ---Nekar Xenos-
>
> I disagree. The format you use should be job specific and a matter of  
> taste. The information you want to convey and to whom is important to  
> what format you use. Degrees of Freedom. That's what I like!
>

Well since you put it that way, I can't disagree with you :)

-- 
-Nekar Xenos-


Post a reply to this message

From: Le Forgeron
Subject: Re: Anyone use datetime?
Date: 24 Nov 2014 04:11:12
Message: <5472f630$1@news.povray.org>
Le 22/11/2014 18:43, Leroy a écrit :
> Your right about the time zone. I check out every thing you said. No luck.
> 
> So is the problem my XP or is it in POV 3.7?

you forget the third component: the one between the screen and the chair
(no offense intended), it's the one that matter in the end.

You can either:
* move your XP to have its clock as UTC (but that might be problematic
for some already installed programs). Btw, the XP clock does not show
any UTC setting, at best you can opt for Greenwich without summer-saving
adjustment.
* add a %z or similar in the format string to copy the time-zone setting
(so 1:30pm local is displayed 7:30pm -0600 ), then the date and time
should be correct but its reading is harder (that's where the third
component came in play)
* if your script is local (not to be shared with someone in Tokyo),
adjust the now parameter as now-0.25 for your situation (and season, yep
you can be screwed in 6 months by a different offset)

-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

From: Leroy
Subject: Re: Anyone use datetime?
Date: 24 Nov 2014 13:17:37
Message: <54737641@news.povray.org>
Le_Forgeron wrote:
> Le 22/11/2014 18:43, Leroy a écrit :
>> Your right about the time zone. I check out every thing you said. No luck.
>>
>> So is the problem my XP or is it in POV 3.7?
> 
> you forget the third component: the one between the screen and the chair
> (no offense intended), it's the one that matter in the end.

programers should program for that :)
> 
> You can either:
> * move your XP to have its clock as UTC (but that might be problematic
> for some already installed programs). Btw, the XP clock does not show
> any UTC setting, at best you can opt for Greenwich without summer-saving
> adjustment.
> * add a %z or similar in the format string to copy the time-zone setting
> (so 1:30pm local is displayed 7:30pm -0600 ), then the date and time
> should be correct but its reading is harder (that's where the third
> component came in play)
> * if your script is local (not to be shared with someone in Tokyo),
> adjust the now parameter as now-0.25 for your situation (and season, yep
> you can be screwed in 6 months by a different offset)
> 
The whole thing wasn't THAT important. By the lack of others yelling 'I 
have trouble too' I can conclude that it's only my problem. I can alway 
just blame Windows and forget it.
Thanks for your help!


Post a reply to this message

From: Stephen
Subject: Re: Anyone use datetime?
Date: 24 Nov 2014 13:36:22
Message: <54737aa6$1@news.povray.org>
On 24/11/2014 18:14, Leroy wrote:
>> you forget the third component: the one between the screen and the chair
>> (no offense intended), it's the one that matter in the end.
>
> programers should program for that :)

Ah! You follow the Microsoft way. :-P

-- 

Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: Anyone use datetime?
Date: 28 Nov 2014 07:01:36
Message: <54786420$1@news.povray.org>
Am 22.11.2014 19:04, schrieb Leroy:

>>> There is only one format for date, Iso 8601. All other formats are
>>> doomed.
>>
>> Agreed. All other formats don't make sense.
>>
>> ---Nekar Xenos-
>
> I disagree. The format you use should be job specific and a matter of
> taste. The information you want to convey and to whom is important to
> what format you use. Degrees of Freedom. That's what I like!

The "to whom" part is only important so long as there are gazillions of 
different time formats out there.

The US-American format (m/d/Y), btw, really excels at not making any sense.


Post a reply to this message

From: Bald Eagle
Subject: Re: Anyone use datetime?
Date: 28 Nov 2014 11:30:01
Message: <web.5478a288731c63c55e7df57c0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> The US-American format (m/d/Y), btw, really excels at not making any sense.

Look at the people who get elected here....

And besides, like songs, formats that don't make any sense are the best, because
then you can read your own meaning into them....     :|


Post a reply to this message

From: Stephen
Subject: Re: Anyone use datetime?
Date: 28 Nov 2014 12:00:14
Message: <5478aa1e$1@news.povray.org>
On 28/11/2014 16:27, Bald Eagle wrote:
> clipka <ano### [at] anonymousorg> wrote:
>
>> The US-American format (m/d/Y), btw, really excels at not making any sense.
>
> Look at the people who get elected here....
>
> And besides, like songs, formats that don't make any sense are the best, because
> then you can read your own meaning into them....     :|
>

Someone who has heard of RS232. ;-)


-- 

Regards
     Stephen


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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