January 1, 2005

WinTask - GetSystemTime

'
' GetSystemTime
'
' Return System's Date and Time information (in UTC [GMT] Time Coordinates)
'
' Author: Joe Strazzere
'

dim pointer as unsigned
dim ptr2 as unsigned

pointer=allocate(255)
wdir$="                "
ret=PokeString(pointer,wdir$,0)
a=External("kernel32","GetSystemTime",pointer)
var$=peekString$(pointer)
ptr2=pointer+0
sysyr   = peekinteger(ptr2,2)
ptr2 = pointer + 2
sysmo   = peekinteger(ptr2,2)
ptr2 = pointer + 4
sysdow  = peekinteger(ptr2,2)
ptr2 = pointer + 6
sysday  = peekinteger(ptr2,2)
ptr2 = pointer + 8
syshr   = peekinteger(ptr2,2)
ptr2 = pointer + 10
sysmin  = peekinteger(ptr2,2)
ptr2 = pointer + 12
syssec  = peekinteger(ptr2,2)
ptr2 = pointer + 14
sysmil  = peekinteger(ptr2,2)
msgbox("Year = "+str$(sysyr))
msgbox("Month = "+str$(sysmo))
msgbox("Day of Week = "+str$(sysdow))
msgbox("Day = "+str$(sysday))
msgbox("Hour = "+str$(syshr))
msgbox("Min = "+str$(sysmin))
msgbox("Sec = "+str$(syssec))
msgbox("Mil = "+str$(sysmil))