Readded our ctime.c - removed equivalent versions from localtime.c, so that

not everything is in this one file.
Removed definition of STD_INSPIRED: this not only fixes some warnings, it
also removes functions that are not exported under BeOS, and there is no
reason to change that.
Added weak export of timelocal() in case STD_INSPIRED is not defined in
localtime.c.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10037 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-11-19 19:44:09 +00:00
parent 6a689590ce
commit 137270c9e6
3 changed files with 29 additions and 25 deletions

View File

@ -1,12 +1,13 @@
SubDir OBOS_TOP src kernel libroot posix time ; SubDir OBOS_TOP src kernel libroot posix time ;
# for localtime.c strftime.c # for localtime.c strftime.c
SubDirCcFlags -DNOID -DTZDIR='\"/etc/timezones\"' -DUSG_COMPAT -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DSTD_INSPIRED=1 -DPCTS=1 ; SubDirCcFlags -DNOID -DTZDIR='\"/etc/timezones\"' -DUSG_COMPAT -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DPCTS=1 ;
UsePrivateHeaders [ FDirName libroot time ] ; UsePrivateHeaders [ FDirName libroot time ] ;
KernelMergeObject posix_time.o : KernelMergeObject posix_time.o :
asctime.c asctime.c
ctime.c
difftime.c difftime.c
localtime.c localtime.c
stime.c stime.c

View File

@ -0,0 +1,23 @@
/*
* Copyright 2004, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#include <time.h>
char *
ctime(const time_t *_timer)
{
return asctime(localtime(_timer));
}
char *
ctime_r(const time_t *_timer, char *buf)
{
struct tm tm;
return asctime_r(localtime_r(_timer, &tm), buf);
}

View File

@ -1243,28 +1243,6 @@ register struct tm * const tmp;
#endif /* defined TM_GMTOFF */ #endif /* defined TM_GMTOFF */
} }
char *
ctime(timep)
const time_t * const timep;
{
/*
** Section 4.12.3.2 of X3.159-1989 requires that
** The ctime function converts the calendar time pointed to by timer
** to local time in the form of a string. It is equivalent to
** asctime(localtime(timer))
*/
return asctime(localtime(timep));
}
char *
ctime_r(timep, buf)
const time_t * const timep;
char * buf;
{
struct tm tm;
return asctime_r(localtime_r(timep, &tm), buf);
}
/* /*
** Adapted from code provided by Robert Elz, who writes: ** Adapted from code provided by Robert Elz, who writes:
@ -1617,7 +1595,9 @@ struct tm * const tmp;
return time1(tmp, localsub, 0L); return time1(tmp, localsub, 0L);
} }
#ifdef STD_INSPIRED #ifndef STD_INSPIRED
#pragma weak timelocal=mktime
#else
time_t time_t
timelocal(tmp) timelocal(tmp)