GMT time...

BlitzMax Forums/BlitzMax Beginners Area/GMT time...

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Hi, after digging in Internet for 2 days...

'Time, day of the week, Time_Zone_Information (bad)

Import "-lkernel32"

Type TIME_ZONE_INFORMATION 'I hope it's works!!!!
	Field bias:Int
	Field standardname:String
	Field date:tsystemtime
	Field daylightname:String
	Field daylightdate:tSystemTime
	Field daylightbias:Long
End Type

Type TSYSTEMTIME 
Field wYear@@
Field wMonth@@
Field wDayOfWeek@@
Field wDay@@
Field wHour@@
Field wMinute@@
Field wSecond@@
Field wMilliseconds@@
End Type

' Must have "Win32" since windows API
Global GetLocalTime(timeBuffer:Byte Ptr) "Win32"
Global GetTimeZoneInformation:Short(timebuffer:Byte Ptr) "Win32"

kernel32 = LoadLibraryA("kernel32.dll")

If Kernel32
	getlocaltime = GetProcAddress(kernel32 , "GetLocalTime")
	GetTimeZoneInformation=GetProcAddress(kernel32,"GetTimeZoneInformation")
Else
	Notify("No lib")
EndIf

Local gmt:time_zone_information = New time_zone_information
GetTimeZoneInformation(gmt)
Print "GMT: " + Float(gmt.bias)/ -60 'don't ask me why negative...

Local time:tSystemTime = New tSystemTime
GetLocalTime(time)
Print "Year       : " + time.wYear
Print "Month       : " + time.wMonth
Print "Day of Week : " + time.wDayOfWeek
Print "Day         : " + time.wDay
Print "H M S       : " + time.wHour + ":" + time.wMinute + ":" + time.wSecond


I can recover (from GetLocalTime) only the GMT (what I'm looking for) but the others info are not correctly interpreted...Well at last it works!!!!
My only problem is: there is another syntax for using API (extern and end extern), but I have encounterd too much error...maybe it's due to the 'size' of the parameters I passed to the functions...

When I have a little time I'm starting digging again to find info for the Mac version....