mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- The strftime() %z conversion now prints the time zone difference as a
"decimal" number. That is, if the difference is 5 hours and 30 minutes, then %z will now print "530" rather than "330". - mktime() now handles one leap second gracefully. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14941 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -54,6 +54,12 @@
|
|||||||
%a/%A conversions for C99. The %j is treated like %ll; %t and %z are treated
|
%a/%A conversions for C99. The %j is treated like %ll; %t and %z are treated
|
||||||
like %l. Also, the "inf"/"infinity"/"nan"/"nan()" keywords are processed.
|
like %l. Also, the "inf"/"infinity"/"nan"/"nan()" keywords are processed.
|
||||||
|
|
||||||
|
- The strftime() %z conversion now prints the time zone difference as a
|
||||||
|
"decimal" number. That is, if the difference is 5 hours and 30 minutes,
|
||||||
|
then %z will now print "530" rather than "330".
|
||||||
|
|
||||||
|
- mktime() now handles one leap second gracefully.
|
||||||
|
|
||||||
|
|
||||||
c.lib 1.191 (9.4.2005)
|
c.lib 1.191 (9.4.2005)
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: time_mktime.c,v 1.8 2005-02-27 21:58:21 obarthel Exp $
|
* $Id: time_mktime.c,v 1.9 2005-05-09 13:47:24 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@ -155,21 +155,23 @@ mktime(struct tm *tm)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tm->tm_sec < 0 || tm->tm_sec > 59)
|
/* Note: the number of seconds can be larger than 59
|
||||||
|
in order to account for leap seconds. */
|
||||||
|
if(tm->tm_sec < 0 || tm->tm_sec > 60)
|
||||||
{
|
{
|
||||||
SHOWVALUE(tm->tm_sec);
|
SHOWVALUE(tm->tm_sec);
|
||||||
SHOWMSG("invalid seconds");
|
SHOWMSG("invalid seconds");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
clock_data.sec = tm->tm_sec;
|
clock_data.sec = (tm->tm_sec > 59) ? 59 : tm->tm_sec;
|
||||||
clock_data.min = tm->tm_min;
|
clock_data.min = tm->tm_min;
|
||||||
clock_data.hour = tm->tm_hour;
|
clock_data.hour = tm->tm_hour;
|
||||||
clock_data.mday = tm->tm_mday;
|
clock_data.mday = tm->tm_mday;
|
||||||
clock_data.month = tm->tm_mon + 1;
|
clock_data.month = tm->tm_mon + 1;
|
||||||
clock_data.year = tm->tm_year + 1900;
|
clock_data.year = tm->tm_year + 1900;
|
||||||
|
|
||||||
seconds = Date2Amiga(&clock_data);
|
seconds = Date2Amiga(&clock_data) + (tm->tm_sec - 59);
|
||||||
|
|
||||||
/* The AmigaOS "epoch" starts with January 1st, 1978, which was
|
/* The AmigaOS "epoch" starts with January 1st, 1978, which was
|
||||||
a Sunday. */
|
a Sunday. */
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: time_strftime.c,v 1.13 2005-05-08 11:27:26 obarthel Exp $
|
* $Id: time_strftime.c,v 1.14 2005-05-09 13:47:24 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@ -431,6 +431,10 @@ format_date(const char *format,const struct tm *tm,struct Hook * hook)
|
|||||||
|
|
||||||
__locale_unlock();
|
__locale_unlock();
|
||||||
|
|
||||||
|
/* The GMT offset is given in minutes. We need to print
|
||||||
|
it as a decimal number. */
|
||||||
|
gmt_offset = (100 * (gmt_offset / 60)) + (gmt_offset % 60);
|
||||||
|
|
||||||
__number_to_string((unsigned int)gmt_offset,buffer,sizeof(buffer),0);
|
__number_to_string((unsigned int)gmt_offset,buffer,sizeof(buffer),0);
|
||||||
store_string_via_hook(buffer,-1,hook);
|
store_string_via_hook(buffer,-1,hook);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user