@Peter87, My bad, forgot the & *updated*
@salem c, @H00G0
very interesting, I saw something like that around.
I'm looking a way to get the same time_t on GMT+0 no matter the os timezone or machine.
If i'm not wrong localtime returns time on os's timezone, perhaps gmtime.
Now we are getting tm struct but I want it to be time_t, I don't see any
function to convert tm into time_t however I did found this
1 2 3 4 5
|
time_t timegm(tm* _Tm)
{
auto t = mktime(_Tm);
return t + (mktime(localtime(&t)) - mktime(gmtime(&t)));
}
| |
That whole thing seems rather too complex for such simple request.
@TheIdeasMan
Something I did looked into however since I was unable to find someone else having the same issue with time(), i figured it wouldn't be no different, I would still get different results on those different machines.
Figured if system's own time is messed up, there's nothing to do. Even tho
by comparing window's clock, they seem right expect on different timezones. It's weird.
I do have a program running which messes with timezones. It's purpose was to change os timezone to fool browser.
For now I ended up writing a php function what displays time() for the server, I downloaded html and converted it into time_t. I do it once a program starts and then just counting seconds on separate thread. oh yeah, this whole thing gave me many headaches.