NO

Author Topic: ctime  (Read 5377 times)

JohnF

  • Guest
ctime
« on: September 21, 2005, 10:54:56 AM »
Small bug I think!

ctime() wraps around to the year 1901 after 0x7c55736f, I assume it should continue up to INT_MAX at least.

EDIT: the year 1900 not 1901

John

Greg

  • Guest
ctime
« Reply #1 on: September 21, 2005, 08:26:55 PM »
I get:

Pelle's C:
Code: [Select]

ctime(0x7C55736F) = Wed Feb  6 22:28:15 2036
ctime(0x7C557370) = Wed Feb  6 22:28:16 2036


VC 2003:
Code: [Select]

ctime(0x7C55736F) = Wed Feb 06 21:28:15 2036
ctime(0x7C557370) = Wed Feb 06 21:28:16 2036


Pacific Daylight Time (DST is in effect).

JohnF

  • Guest
ctime
« Reply #2 on: September 21, 2005, 09:07:27 PM »
Quote from: "Greg"
I get:
Code: [Select]
ctime(0x7C55736F) = Wed Feb  6 21:28:15 2036
ctime(0x7C557370) = Wed Feb  6 22:28:16 2036

in both Pelle's C and VC 2003.


In PellesC I get

0x7c55736f Thu Feb 7 06:28:15 2036
0x7c557370 Mon Jan 1 00:00:00 1900

In VC6 I get

0x7c55736f Thu Feb 7 05:28:15 2036
0x7c557370 Thu Feb 7 05:28:16 2036

I don't know why we get different results.

John

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
ctime
« Reply #3 on: September 21, 2005, 09:52:23 PM »
I get weird results here too...

I think it has to do with Daylight Savings Time (DST). A previous bug was affected by this, and I did just enough to fix that -- but it seems to be more to this story.

I will look at it (might take a while...)

Pelle
/Pelle

JohnF

  • Guest
ctime
« Reply #4 on: September 21, 2005, 11:11:08 PM »
Ok thanks.

John

Greg

  • Guest
ctime
« Reply #5 on: September 21, 2005, 11:45:16 PM »
On closer examination, my post above wasn't entirely accurate. It is now.

Greg

  • Guest
ctime
« Reply #6 on: September 24, 2005, 06:45:07 AM »
Pelle,

Looks like you nailed the DST problem.
 
Pelles C 4.00 Beta 6:
Code: [Select]

ctime(0x7C55736F) = Wed Feb  6 21:28:15 2036
ctime(0x7C557370) = Wed Feb  6 21:28:16 2036


VC 2003:
Code: [Select]

ctime(0x7C55736F) = Wed Feb 06 21:28:15 2036
ctime(0x7C557370) = Wed Feb 06 21:28:16 2036


I bet you get tired of people comparing Pelles C with Visual C.  :lol:  

Thanks for all your efforts.

Greg

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
ctime
« Reply #7 on: September 24, 2005, 04:28:18 PM »
Quote from: "Greg"
Looks like you nailed the DST problem.

Great!

Quote from: "Greg"

I bet you get tired of people comparing Pelles C with Visual C.  :lol:  

Well... not really, since I sometime do it myself... ;-)

Quote from: "Greg"

Thanks for all your efforts.

Thanks!

Pelle
/Pelle