mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Moved the common DateStamp to time_t conversion code into a shared
function. - The fall-back function for converting time into a string in strftime() now calls itself for the "%x" and "%X" format specifiers. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14809 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: time_time.c,v 1.2 2005-01-02 09:07:19 obarthel Exp $
|
||||
* $Id: time_time.c,v 1.3 2005-01-24 10:25:46 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -45,22 +45,15 @@ time_t
|
||||
time(time_t * tptr)
|
||||
{
|
||||
struct DateStamp ds;
|
||||
ULONG seconds;
|
||||
time_t result;
|
||||
|
||||
PROFILE_OFF();
|
||||
DateStamp(&ds);
|
||||
PROFILE_ON();
|
||||
|
||||
seconds = 60 * ((ULONG)ds.ds_Minute + 24 * 60 * (ULONG)ds.ds_Days) + (ds.ds_Tick / TICKS_PER_SECOND);
|
||||
|
||||
/* time() should try to return the current time in UTC form. Thus,
|
||||
* we have to take the local time zone into account.
|
||||
*/
|
||||
if(__default_locale != NULL)
|
||||
result = UNIX_TIME_OFFSET + seconds + 60 * __default_locale->loc_GMTOffset;
|
||||
else
|
||||
result = UNIX_TIME_OFFSET + seconds;
|
||||
/* This converts the DateStamp contents into the number of
|
||||
seconds elapsed since January 1st 1970. */
|
||||
result = __convert_datestamp_to_time(&ds);
|
||||
|
||||
if(tptr != NULL)
|
||||
(*tptr) = result;
|
||||
|
||||
Reference in New Issue
Block a user