|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'm having some trouble.
I'm trying to have POV write datetime to a file in the form:
// Made Wednesday 11-19-2014 07:33 PM
Everything is fine except the hour: it was 1:33 PM
Here what I wrote:
#write(Mfile,"// Made ",datetime(now,"%A %m-%d-%Y %I:%M %p"),"\n")
The (%I) above, I got from my C++ book and don't have a C book.
I don't think there can be much different between them.
Is there something I missing, or is this a POV 3.7 bug?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 20/11/2014 20:48, Leroy wrote:
> I'm having some trouble.
> I'm trying to have POV write datetime to a file in the form:
>
> // Made Wednesday 11-19-2014 07:33 PM
>
> Everything is fine except the hour: it was 1:33 PM
>
> Here what I wrote:
> #write(Mfile,"// Made ",datetime(now,"%A %m-%d-%Y %I:%M %p"),"\n")
>
> The (%I) above, I got from my C++ book and don't have a C book.
> I don't think there can be much different between them.
> Is there something I missing, or is this a POV 3.7 bug?
datetime is from boost.
Your date format is not correct. '-' is for iso 8601, american's date
should use '/'. 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.
The difference of 6 hours might be due to your timezone (which you did
not print, or its settings somewhere): give a try to "%z", "%Z" or "%ZP"
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 20/11/2014 21:16, Le_Forgeron wrote:
> On 20/11/2014 20:48, Leroy wrote:
>> I'm having some trouble.
>> I'm trying to have POV write datetime to a file in the form:
>>
>> // Made Wednesday 11-19-2014 07:33 PM
>>
>> Everything is fine except the hour: it was 1:33 PM
>>
>> Here what I wrote:
>> #write(Mfile,"// Made ",datetime(now,"%A %m-%d-%Y %I:%M %p"),"\n")
>>
>> The (%I) above, I got from my C++ book and don't have a C book.
>> I don't think there can be much different between them.
>> Is there something I missing, or is this a POV 3.7 bug?
>
> datetime is from boost.
My bad, povray's datetime is using strftime(), after getting the LC_TIME
environment variable from your environment.
>
> Your date format is not correct. '-' is for iso 8601, american's date
> should use '/'. 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.
>
> The difference of 6 hours might be due to your timezone (which you did
> not print, or its settings somewhere): give a try to "%z", "%Z" or "%ZP"
>
Yep, "%z" or "%Z" might give you a clue about the actual clock.
If you are running something like Windows, the traditional setting of
the bios clock might be "local clock" (and that's not a good idea).
Bios clock are better as UTC clock (Never adjust them on Day-saving
change). Even better, sync them with NTP servers.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks for the quick reply!
I have Windows XP.
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.
I've used strftime() before to write a time stamp program to place the
time/date in a POV file and to write a calender program.
Before I go I have to tell ya about my fun with 'now'.
I put zero in just to what would happen. I got the same date and time as
POV docs. Then for fun I through in bigger numbers, I don't remember all
the different numbers I use but I did get Wednesday 6/22/1926 out of
one. I have to check it out on my calender. It was right!
Thanks for the help, looks like I have some work to do!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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-
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |