[Gambas-user] Unix time format

Martin mbelmonte at belmotek.net
Fri Aug 5 10:03:57 CEST 2022


El 4/8/22 a las 21:09, T Lee Davidson escribió:
 > When I use `stat` on a file, I get a format different than what you 
stated; eg. "2022-01-01 13:30:47.592253508 -0500"
Ok, it is correct, but I use a class that is an implementation of "libc"

Library "libc:6"

Public Struct stat_
...
   st_mtime As Long
...
End Struct

Private Const _STAT_VER_LINUX As Integer = 1
Private Extern __xstat(_STAT_VER As Integer, __path As String, __statbuf 
As Stat_) As Integer

Then i get a long number for dates, which is very useful for comparing 
file times.

 > But, no matter, perhaps what you are looking for is the FromUnixTime 
method of Date (gb.util).
 > http://gambaswiki.org/wiki/comp/gb.util/date

Cool, Date.ToUnixTime is what I need, because is faster operate directly 
whit unix time due to the fact that it is not necessary to convert the 
variable.

Config.LastScann = Date.ToUnixTime(Now())

Regards.


More information about the User mailing list