GMT time...
BlitzMax Forums/BlitzMax Beginners Area/GMT time...
| ||
I think this is the strangest question ever made on this forum....How I can check (via Bmax) the 'local time', I mean the offset by GMT? For example in Italy the GMT is +1... I have a little problem when I try to convert the timestamp to a 'human' time... Thanks in advance |
| ||
Ask via API what timezone the user choose. |
| ||
Or ask the user yourself what timezone they're in. |
| ||
Ok. thanks |
| ||
There are various API calls available on all the platforms for finding out this kind of information. Google is your friend ;-) |
| ||
Hi, after digging in Internet for 2 days... 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.... |
| ||
What's the @@ after the fields of TSYSTEMTIME? Is tha the quick way of declaring a short? ( It's not listed as such in the docs, but that's no guarantee. ) |
| ||
Yes @@ --> :short, I found this after digging for 2 days...(and after many trial&errors...) I'm not a C++ expert so many C structures refers to word, uword, char & so on...It's a pain for my little brain |
| ||
Handy code. Yes @@ --> :short, I found this after digging for 2 days...(and after many trial&errors...) I'm not a C++ expert so many C structures refers to word, uword, char & so on...It's a pain for my little brain You'll get used to it :) |
| ||
Speaking of C, could you not do a multi-platform version with these? (not sure if the declarations are exactly right, I can't quite get it working properly) Type tm Field tm_sec:Int Field tm_min:Int Field tm_hour:Int Field tm_mday:Int Field tm_mon:Int Field tm_year:Int Field tm_wday:Int Field tm_yday:Int Field tm_isdst:Int Field tm_gmtoff:Long Field tm_zone:Byte Ptr End Type Type time_t Field hour:Byte Field minute:Byte Field second:Byte Field hsecond:Byte End Type Extern "C" Function localtime:tm(time:Byte Ptr) = "localtime" Function time:time_t(time:Byte Ptr) = "time" End Extern |
| ||
Maybe you could use this: http://klepto2.kl.funpic.de/include.php?path=content/download.php&contentid=14&download=go It is a ext Time Module which now also supports Microunix time and it is easy to use. |
| ||
Import pub.stdc Extern "C" Function gmtime_:Byte Ptr(time:Byte Ptr) = "gmtime" End Extern Local calendarTime[1], buff:Byte[256] time_(calendarTime) strftime_(buff, buff.length, "%A %d %B %Y - %H:%M:%S (%Z)", localtime_(calendarTime)) Print String.FromCString(buff) strftime_(buff, buff.length, "%A %d %B %Y - %H:%M:%S", gmtime_(calendarTime)) Print String.FromCString(buff) + " (GMT Standard Time)" ?? |
| ||
wtf!!! all this work for something there is already?!??! arghhhhhhhh..... :( well something new to understand, thanks anyway. |
| ||
what about getting the current unix timestamp for current time?? I mean without writing a temporary file and then filetime it to get the current timestamp..... Any ideas anyone? Last edited 2011 |
| ||
bump |
| ||
Extern "c" Function time(timer:Byte Ptr) End Extern debuglog time(Null) Last edited 2011 |
| ||
In the above code, calenderTime *is* unix time*...unixTime = time_(Null) ...OR... time_(Varptr(unixTime)) *I just used a weird ass method of getting a integer pointer. :o| [edit] Taskmaster beat me to it...That's what happens when you try to post whilst watching 'Robinson Crusoe On Mars' on youtube. ;o) [/edit] Last edited 2011 |
| ||
Thanks alot... for those nifty little tips ;-) |