Home » U++ Library support » U++ Core » Time::Set(int64 scalar) unexpected results
Re: Time::Set(int64 scalar) unexpected results [message #40732 is a reply to message #40730] |
Tue, 10 September 2013 20:52   |
|
Hi Alboni,
That is not a bug, it is just how the Time in U++ is designed. Unix timestamp is 32bit number, describing times from 1.1.1970 to someday in 2038. U++ Time works for dates from 4000 B.C. to 4000 A.D. if I remember correctly.
Maybe there is an explicit method to convert the timestamp to Time that I don't know about... But AFAIK the simplest way (at least on POSIX) is to use FileTime, which is just a wrapper around time_t.
So you should be able to doTime t = FileTime(timestamp);
Another possible solution, that should IMHO work correctly even on windows, could be something likeconst Time epoch(1970,1,1);
Time t;
t.Set(epoch.Get()+timestamp);
Best regards,
Honza
PS: You're right about U++ intentionally using year 0 as a center point for time. As it uses signed type, it allows for both negative and positive values so it can accurately represent about 8000 years timespan.
[Updated on: Tue, 10 September 2013 20:55] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Apr 27 11:42:50 CEST 2025
Total time taken to generate the page: 0.00702 seconds
|