flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
gunblade 02 Jul 2012, 10:47
As far as i know, its not possible. The way "date" seems to do it is by using the clock_gettime(CLOCK_REALTIME..) and then reading /etc/localtime in order to get offset info.
I tested - and I also get 0/0 for timezone info as a return from gettimeofday.. so yeah.. i think you may have to open /etc/localtime and figure it out from there (not sure what the format of that file is - but its probably described somewhere out there, seems to be binary rather than just a text/config file). |
|||
![]() |
|
JohnFound 02 Jul 2012, 12:29
Thanks. I will search this file format. (Or can try to reverse it - in Linux it is often easier, than searching for documentation.
![]() IMHO, it is bad idea to read different config files from inside the library function, but I can read this file on start up and keep the data in a variable. Thanks for this information. |
|||
![]() |
|
LocoDelAssembly 02 Jul 2012, 14:29
Isn't an option just using libc (or whatever library providing the function)? The problem is what if some distro doesn't work that way (using /etc/localtime I mean).*
BTW, reading the file at startup only might not be a good idea, if the user changes the config while your app is still running I think it should start reporting the same time as the rest of the system. |
|||
![]() |
|
revolution 02 Jul 2012, 16:00
LocoDelAssembly wrote: BTW, reading the file at startup only might not be a good idea, if the user changes the config while your app is still running I think it should start reporting the same time as the rest of the system.
|
|||
![]() |
|
JohnFound 02 Jul 2012, 16:40
LocoDelAssembly, I want to use libc as little as possible and possibly to not use it at all.
You and revolution, both are right that reading once is not a good idea as well. I will think about it. At least searching the timezone information is not so often used functions, so I can make it simply to read the file (2104bytes) on my system ![]() |
|||
![]() |
|
JohnFound 02 Jul 2012, 17:23
OK, I found the file format. It is described in "man tzfile". The file format keeps information about all local time changes sinse 1970year, that is why it is so big.
Anyway, the format is relatively simple and I will make some procedure to read it. Thanks for pointing me in the right direction. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.