Documentation of LTIME
Manfred Schwarb
manfred99@gmx.ch
Sat Nov 26 12:45:00 GMT 2016
Am 26.11.2016 um 13:17 schrieb Janus Weil:
> Hi Francisco,
>
>> In the online documentation of LTIME,
>> https://gcc.gnu.org/onlinedocs/gfortran/LTIME.html#LTIME, is written:
>>
>> Return value:
>> The elements of VALUES are assigned as follows:
>>
>> 1. Seconds after the minute, range 0â59 or 0â61 to allow for
>> leap seconds
>> 2. Minutes after the hour, range 0â59
>> 3. Hours past midnight, range 0â23
>> 4. Day of month, range 0â31
>> 5. Number of months since January, range 0â12
>>
>> I imagine that range should be 0-30 for 4. and 0-11 for 5.
>
> I image it should be be 1-31 and 1-12, however my test program
> indicates it might be 1-31 and 0-11, which is certainly inconsistent:
>
> program p
>
> integer values(9)
> call ltime(time(), values)
>
> print *,'time: ',values(3),':',values(2),':',values(1)
> print *,'date: ',values(4),'.',values(5),'.',1900+values(6)
> print *,values(7)
> print *,values(8)
> print *,values(9)
>
> end program
>
I tried g77, and it gives the same result, 10 and 26.
So it's this way since ages.
And it makes sense, as ltime seems to be a simple wrapper around localtime(3),
and the manual page for localtime states:
tm_mon The number of months since January, in the range 0 to 11.
So it seems gfortran code is "correct", documentation is wrong.
BTW, day of month should have range 1-31, and
seconds should have range 0-60 (only on leap second possible according to localtime(3)),
and "Days since January 1" should have range 0-365 added.
Cheers,
Manfred
> This gives me:
>
> date: 26 . 10 . 2016
>
> In any case the documentation is wrong. Could you please open a bug
> report in bugzilla for that?
>
> Cheers,
> Janus
>
More information about the Fortran
mailing list