[Gambas-user] Different quantities of seconds from UNIX date...

Benoît Minisini g4mba5 at gmail.com
Sat Apr 7 18:15:10 CEST 2018


Le 07/04/2018 à 02:02, vuott at tiscali.it a écrit :
> Hello,
> 
> I do not understand why these two lines do not return the same result.
> 
> Public Sub Main()
> 
> Print CFloat(DateDiff(CDate("01/01/1970"), Now, gb.Second))
> 
> Print CFloat(Date.ToUnixTime(Now))      ' Obviously we have to activate 
> "gb.util" Component
> 
> End
> 
> 
> So that the two results are identical, I have to add 4 hours !
> 
> Public Sub Main()
> 
> Print CFloat(DateDiff(CDate("01/01/1970 04:00:00"), Now, gb.Second))     
> '  Here I have to add 4 hours !
> 
> Print CFloat(Date.ToUnixTime(Now))
> 
> End
> 
> 
> regards
> vuott
> 

It's a bug in Date.ToUnixTime() and Date.FromUnixTime() function.

Can you try with commit 
https://gitlab.com/gambas/gambas/commit/72384c0806071556d50e1e8870dd12f868985155 
?

Regards,

-- 
Benoît Minisini


More information about the User mailing list