Date library and UNIX time ... 64-bit ?

Everything else that doesn't fall into one of the other PB categories.
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Date library and UNIX time ... 64-bit ?

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Date library and UNIX time ... 64-bit ?

Post by ts-soft »

You can use some quad-based codes like:
http://www.purebasic.fr/german/viewtopi ... 72#p315072
http://www.purebasic.fr/german/viewtopi ... 63#p207863
i think, you will found some other codes in english :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Date library and UNIX time ... 64-bit ?

Post by USCode »

Moderator, please move this to Feature Requests.
Thanks
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Date library and UNIX time ... 64-bit ?

Post 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
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Date library and UNIX time ... 64-bit ?

Post 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.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Date library and UNIX time ... 64-bit ?

Post by davido »

@USCode
In the meantime you could look at this code by Wilbert:

http://www.purebasic.fr/english/viewtop ... 12#p421612
DE AA EB
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Date library and UNIX time ... 64-bit ?

Post 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! :-\
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Date library and UNIX time ... 64-bit ?

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Date library and UNIX time ... 64-bit ?

Post by USCode »

Now that PB supports quads it is doable now?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Date library and UNIX time ... 64-bit ?

Post 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

:(
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Post Reply