[fpc-devel] OS2 DOSCALLS and timezone

waldo kitty wkitty42 at windstream.net
Mon Apr 7 18:47:49 CEST 2014


i've a need to work with the OS2 timezone parameter in the OS' system clock... 
i'm not understanding a few things and haven't been able to figure out the code 
path so i'm writing here to ask for some assistance... if this should be in the 
user's list, please let me know and i'll move the conversation over there...

ok, so...

if i do not use the doscalls unit, the timezone parameter returns as 0 (zero) 
instead of -1 when it is uninitialized... if i use the doscalls unit, i get -1 
as desired... now the problem comes with how to set the timezone to the locale 
the system is located in...

i know that FPC on OS2 uses EMX for some/most/all of its accesses... rummaging 
through the EMX code shows that it explicitly does not allow a write to the 
timezone field... the EMX code also shows another field, dstflag, which appears 
to be forced to 0 (zero) but i have not been able to access this field...

additional rummaging in the EMX code shows that the timezone field in time.h is 
made of two ints, tz_minuteswest and tz_dsttime but again, i don't know how to 
get to them...

the thing about all of this is that work in the OS was left unfinished... there 
is supposed to be an app (clock most likely) that handles setting the timezone 
stuff when necessary and adjusting it when daylight saving switches on and 
off... there was one (worldclock IIRC) that used to do this but it is no longer 
included in eCS... peter moylan wrote a tool, TZSet, that checks and sets the OS 
clock's timezone field based on the TZ environment variable but this tool has to 
be executed more often than just on boot... preferably daily as soon after 0200 
(or whenever one's local DST changes) as possible...

my idea was to see about writing a small clock tool to handle this like the no 
longer included clock tool did...

i'm not sure what needs to be done to gain access to the dstflag or the timezone 
structs and am not really sure what they are supposed to contain... any 
assistance in this would be helpful... i can get some source code in modula-2 
which i understand is similar to pascal but then i'm still stuck with accessing 
everything thru EMX or, some how, directly into the system which is likely a bit 
more dangerous for my playing...

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.



More information about the fpc-devel mailing list