News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

ctime

Started by JohnF, September 21, 2005, 10:54:56 AM

Previous topic - Next topic

JohnF

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

I get:

Pelle's C:

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


VC 2003:

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

Quote from: "Greg"I get:
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

Pelle

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


Greg

On closer examination, my post above wasn't entirely accurate. It is now.

Greg

Pelle,

Looks like you nailed the DST problem.

Pelles C 4.00 Beta 6:

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


VC 2003:

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

Pelle

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