Without a machine nearby, I'd risk you're in the right track.

The DIM AS LONG creates 64bit vars while DateDiff may return 32bit data (don't 
have the docs with me).

Print will use 64bit to print the vars and 32bit with direct DateDiff (you may 
confirm by using CLng to affect the DateDiff's in the second Print)

Remember that when you have the most significant bit (MSB) set, Gambas will 
interpret the value as twos-complement sign and yield negative values.


On Aug 6, 2017, 10:21, at 10:21, Hans Lehmann <h...@gambas-buch.de> wrote:
>Why are two different results:
>Public Sub Main()
>   Dim a, b As Long
>   a = DateDiff("01/01/1900", "01/01/1935", gb.Second)
>   b = DateDiff("01/01/1935", "01/01/1970 ", gb.Second)
>   Print a + b
>   Print DateDiff("01/01/1900", "01/01/1935", gb.Second) + 
>DateDiff("01/01/1935", "01/01/1970 ", gb.Second)
>2208988800     ' ok
>-2085978496    ' complement?
>Best regards
>Check out the vibrant tech community on one of the world's most
>engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>Gambas-user mailing list
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Gambas-user mailing list

Reply via email to