Page 1 of 1
Date library and UNIX time ... 64-bit ?
Posted: Sun Oct 13, 2013 8:42 pm
by USCode
According to the PB documentation, PB uses UNIX time:
http://www.purebasic.com/documentation/date/index.html
This is "the number of seconds elapsed since the 1st of January 1970", so the "supported date/time values are 1970-01-01, 00:00:00 for the minimum and 2038-01-19, 03:14:07 for the maximum".
If you wanted to work with dates before 1970 (e.g. birth dates) or beyond 2038 (e.g. retirement calculations), then you can't use the PB Date library, correct?
However, isn't this a 32-bit limitation? Now that PB supports 64-bits, can the 64 bit version support the almost unlimited date range of 64-bit integers?
References:
http://en.wikipedia.org/wiki/Unix_time
http://www.sqlite.org/lang_datefunc.html
Re: Date library and UNIX time ... 64-bit ?
Posted: Sun Oct 13, 2013 9:00 pm
by ts-soft
Re: Date library and UNIX time ... 64-bit ?
Posted: Sat Dec 28, 2013 5:08 am
by USCode
Moderator, please move this to Feature Requests.
Thanks
Re: Date library and UNIX time ... 64-bit ?
Posted: Sat Dec 28, 2013 5:30 am
by PB
> please move this to Feature Requests
No need. It's been requested before lots of times.
Last example found:
http://www.purebasic.fr/english/viewtop ... =3&t=49666
Re: Date library and UNIX time ... 64-bit ?
Posted: Sat Dec 28, 2013 2:57 pm
by BorisTheOld
USCode wrote:If you wanted to work with dates before 1970 (e.g. birth dates) or beyond 2038 (e.g. retirement calculations), then you can't use the PB Date library, correct?
We get around the problem by using the Date features in PowerBasic and FreeBasic.
We've created two dynamic libraries -- a PowerBasic DLL for use with Windows, and a FreeBasic SO for use with Linux. They are very small libraries (less than 100 statements each) that give us access to a few low-level features, such as shareable file I/O and date-serial manipulation.
Access to these two libraries is via a small PB wrapper module. The rest of our code is 100% cross-platform PB.
Re: Date library and UNIX time ... 64-bit ?
Posted: Sat Dec 28, 2013 4:45 pm
by davido
@
USCode
In the meantime you could look at this code by
Wilbert:
http://www.purebasic.fr/english/viewtop ... 12#p421612
Re: Date library and UNIX time ... 64-bit ?
Posted: Sat Dec 28, 2013 6:37 pm
by USCode
Thanks guys, but what about the PB date/time related gadgets CalendarGadget and DateGadget?
Using GetGadgetState() and SetGadgetState() on them still limits the allowed date range?
It is surprising this issue still exists, I would think this would be a much higher priority than some other new features that have been added. Isn't this pretty doable with the 64-bit compilers now or is there another limitation? What if you just wanted to develop an application that stored dates in history or birth dates? Maybe it's because Fred was born AFTER 1-JAN-1970 ...

... some of us were born before that date! :-\
Re: Date library and UNIX time ... 64-bit ?
Posted: Sun Dec 29, 2013 2:18 am
by PB
> what about the PB date/time related gadgets CalendarGadget and DateGadget?
> Using GetGadgetState() and SetGadgetState() on them still limits the allowed date range?
See Freak's post here:
http://www.purebasic.fr/english/viewtop ... 08#p105008
> Isn't this pretty doable with the 64-bit compilers now
Most PCs these days are still only 32-bit. They can't be left out.
Re: Date library and UNIX time ... 64-bit ?
Posted: Sun Dec 29, 2013 5:26 am
by USCode
Now that PB supports quads it is doable now?
Re: Date library and UNIX time ... 64-bit ?
Posted: Sun Dec 29, 2013 5:44 am
by PB
> Now that PB supports quads it is doable now?
The exact same question remains unanswered here:
http://www.purebasic.fr/english/viewtop ... 21#p370021
