|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Wed Jun 07, 2006 7:23 am Post subject: IDATE routine: millenium bug? |
|
|
Hi everybody,
I just discovered a strange thing in the IDATE Fortran-routine.
The following piece of code
INTEGER*4, DIMENSION(1:3) :: today
CALL IDATE (today) ! today(1)=day, (2)=month, (3)=year
PRINT*, today(1), today(2), today(3)
produces the result
7 6 106
7 is correct, 6 is also correct, but why 106 for the year?
Is this a compiler error, or am I doing something wrong?
Any advice is very much appreciated!
Lucas.
Lucas |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Jun 07, 2006 10:11 am Post subject: IDATE routine: millenium bug? |
|
|
Lucas
It uses the localtime Microsoft function and the tm structure which has
tm_year: Year (current year minus 1900).
So you have to add 1900 to the result.
IDATE is not documented in the current help file.
Maybe you should be using the standard Fortran intrinsic DATE_AND_TIME.
|
|
Back to top |
|
|
Anonymous Guest
|
Posted: Wed Jun 07, 2006 3:44 pm Post subject: IDATE routine: millenium bug? |
|
|
Hello Paul,
Many thanks for your information!
Indeed, the subroutine DATE_AND_TIME works perfect and the "1900"-problem is completely vanished!
Kind regards,
Lucas. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|