Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread DateTime .. 32bits?
Fri, Apr 10 2015 4:23 PMPermanent Link

Bruno Larochelle

I've seen some discussion about DateTime etc, but one thing I can't figure out..

The EWB help file indicates that the DateTime type is a 32-bit integer.

That would give it a maximum value of about 4.3 billion.

But the # of milliseconds since 1970.. is about 1.4 trillion.

This suggest to me that DateTime is possibly a 64 bit integer (??).

Sample code below does output correctly.. about 1.4 trillion seconds since 1970 right 'now'.

////////////////

procedure TfrmMain.Button1Click(Sender: TObject);
var
dtTest: Datetime;
begin            

dtTest := now;

showmessage(intToStr(integer(dtTest)));

end;


////////////////


more curious than anything else, because it appears to be functional
Logiciels Bitwise Software
Edmonton, AB, Canada
Mon, Apr 13 2015 3:52 AMPermanent Link

Matthew Jones

Bruno Larochelle wrote:

> The EWB help file indicates that the DateTime type is a 32-bit
> integer.
>
> That would give it a maximum value of about 4.3 billion.
>
> But the # of milliseconds since 1970.. is about 1.4 trillion.
>
> This suggest to me that DateTime is possibly a 64 bit integer (??).

It is indeed in milliseconds, but if I recall correctly, Javascript
doesn't have an integral number, so it won't be 32 bits. A quick google
shows that it has a "Number" type, which has a Number.MAX_SAFE_INTEGER
value of (2^53 - 1) which therefore implies a 52 bit integer.
Apparently that's 9007199254740991 in value.

A good question, and the help needs updating! 8-)

--

Matthew Jones
Mon, Apr 13 2015 11:13 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bruno,

<< The EWB help file indicates that the DateTime type is a 32-bit integer.

That would give it a maximum value of about 4.3 billion.

But the # of milliseconds since 1970.. is about 1.4 trillion.

This suggest to me that DateTime is possibly a 64 bit integer (??). >>

This is a hard thing to describe since EWB has both a design-time execution
environment that is more like Delphi, as well as the execution environment,
which is Javascript with all of its number weirdness.

The 32-bit integer description is *mostly* correct.  Yes, you can use
integers larger than 32-bits, but not if you want to do things like bitwise
operators.  Therefore, the manual just says 32-bit.  However, I've changed
it to say 52-bit in order to be more exact.   The EWB design-time execution
engine can actually do full 64-bit, signed integers, but that's just a minor
difference that probably won't affect anyone dealing with the design-time
environment for controls/components.

The one thing that was definitely wrong, however, was that the Double type
was described as a 32-bit floating point number in the manual.  That should
definitely be "64-bit".

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Apr 13 2015 11:14 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bruno,

BTW, the "design-time" references in that last post were all about EWB 2,
not EWB 1.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Apr 13 2015 1:41 PMPermanent Link

Bruno Larochelle

excellent, thanks for the response


"Tim Young [Elevate Software]" wrote:

Bruno,

BTW, the "design-time" references in that last post were all about EWB 2,
not EWB 1.

Tim Young
Elevate Software
www.elevatesoft.com
Image