NO

Author Topic: _ftime problem  (Read 26516 times)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #15 on: December 30, 2004, 11:21:02 PM »
Thanks for the update, Robert! Seems to work in two time-zones at least...

Pelle
/Pelle

tiwag

  • Guest
_ftime problem
« Reply #16 on: December 31, 2004, 09:35:18 AM »
Hi Pelle,

timetest also works correct here at my location using CET

WinXP SP2

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #17 on: December 31, 2004, 04:08:19 PM »
Hello tiwag,

Thanks for the info - good to know.

Pelle
/Pelle

Greg

  • Guest
_ftime problem
« Reply #18 on: January 11, 2005, 04:04:06 AM »
The timezone issues with _ftime, localtime etc. are all corrected in the 3.00.0 Beta #1.

Thanks for all your efforts Pele. I'm liking Pelle's C more and more all the time.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #19 on: January 11, 2005, 06:35:20 PM »
Thanks! That's what I needed - some good news... ;)

Pelle
/Pelle

Garvan

  • Guest
_ftime problem
« Reply #20 on: January 13, 2005, 11:32:46 AM »
Hi Pelle:

_ftime() is still broken in version 3.00.0 beta 1. If fails in time-zones greater than +6 GMT. The timezone returns 0, and UTC time is returned instead of local time.

I tested your posted timetest.exe while in Holland, and it worked, but that was not much of a test, was it? I am in Bangkok (+7GMT) now and it does not work here.

Is the function _tzset(); needed? VC++ seams to work with or without it, and I could not find it in PellesC.

Garvan

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #21 on: January 13, 2005, 03:33:28 PM »
Hello Garvan,

Quote from: "Garvan"

I tested your posted timetest.exe while in Holland, and it worked, but that was not much of a test, was it? I am in Bangkok (+7GMT) now and it does not work here.

Test for me, in the sense that if localtime() is working, there is no fundamental flaw in calculating the timezone offset. If only _ftime() is wrong, I should look in one place for the problem. If also localtime() is wrong, I should look at the "bigger picture". This is why I wanted as many people as possible, from different timezones, to report the results.

Quote from: "Garvan"

Is the function _tzset(); needed? VC++ seams to work with or without it, and I could not find it in PellesC.

According to the docs, the _tzset function uses the current setting of the environment variable TZ to assign values to three global variables.
I have similar code, that checks the environment variable TZ, but it's called automatically - no need to call any _tzset function (if I can't find the TZ variable, I fall back and ask Windows about the "TZ" value, which is the parsed/analyzed).

I tried changing the Windows timezone setting, on my Swedish Windows XP, to various zones over the world (+/- many hours from GMT). It worked for most places, but not for some. I wasn't sure if this is because my Swedish version lacks some "setting files", or if there is a problem *sometimes*.

Pelle
/Pelle

Greg

  • Guest
_ftime problem
« Reply #22 on: January 13, 2005, 10:54:31 PM »
Those functions are all working correctly for me with the 3.00.0 Beta #1.

My timezone is Pacific Standard Time ( GMT-8 )  or TZ=PST8PDT.

Greg

  • Guest
_ftime problem
« Reply #23 on: January 14, 2005, 12:00:52 AM »
Pelle,

May I suggest you post the source code for timetest.exe so people can try it in their time zone and everyone would be using the same code.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #24 on: January 14, 2005, 12:56:00 AM »
OK, here is the code - I have added a call to gmtime() for completeness.

Pelle
/Pelle

Greg

  • Guest
_ftime problem
« Reply #25 on: January 14, 2005, 03:29:40 AM »
timetest.c returns all the correct values here ( GMT-8 ) using both crt.lib and pocrt.lib version 3.00.0 Beta #1.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #26 on: January 14, 2005, 04:17:57 AM »
Thanks for the info, Greg. It works here too (GMT+1) - not sure why it fails on some machines.

Pelle
/Pelle

Greg

  • Guest
_ftime problem
« Reply #27 on: January 14, 2005, 04:43:00 AM »
Pelle,

Quote
(GMT+1)


You are either up very late or up very early.  :)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
_ftime problem
« Reply #28 on: January 14, 2005, 04:51:13 AM »
Way too late... but I promise, I will go to bed now...  :shock:

Pelle
/Pelle

Garvan

  • Guest
_ftime problem
« Reply #29 on: January 14, 2005, 06:52:12 AM »
Hi Pelle:

Sorry for not making my report clearer. localtime is also wrong.

This is a comparison result from running your code compiled with VC and then PellesC in a batch file. I am at GMT+7, using WinXP with the 3.0 beta 1 release.

Thanks

Garvan


VC++
_ftime() reports:
  seconds...........1105680571
  milliseconds......14
  UTC offset........-420 minutes
  daylight saving...No

localtime() reports:
  year..............2005
  month.............1
  day...............14
  hours.............12
  minutes...........29
  seconds...........31
  day of week.......Fri
  day of year.......13
  daylight saving...No

gmtime() reports:
  year.............2005
  month............1
  day..............14
  hours............5
  minutes..........29
  seconds..........31
  day of week......Fri
  day of year......13
  daylight saving..No


-----------
PellesC
_ftime() reports:
  seconds...........1105680571
  milliseconds......34
  UTC offset........0 minutes
  daylight saving...Unknown

localtime() reports:
  year..............2005
  month.............1
  day...............14
  hours.............5
  minutes...........29
  seconds...........31
  day of week.......Fri
  day of year.......13
  daylight saving...Unknown

gmtime() reports:
  year.............2005
  month............1
  day..............14
  hours............5
  minutes..........29
  seconds..........31
  day of week......Fri
  day of year......13
  daylight saving..No