mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add ctime{,_r}(3).
This commit is contained in:
parent
c6d1285337
commit
b852fbcc9b
3 changed files with 39 additions and 6 deletions
|
@ -27,7 +27,6 @@ bsearch.o \
|
|||
calloc.o \
|
||||
clearerr.o \
|
||||
c++.o \
|
||||
ctime.o \
|
||||
ctype.o \
|
||||
dir.o \
|
||||
div.o \
|
||||
|
@ -122,6 +121,8 @@ strtok_r.o \
|
|||
strxfrm.o \
|
||||
time/asctime.o \
|
||||
time/asctime_r.o \
|
||||
time/ctime.o \
|
||||
time/ctime_r.o \
|
||||
timespec.o \
|
||||
time/strftime.o \
|
||||
ungetc.o \
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
|
@ -17,14 +17,15 @@
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ctime.cpp
|
||||
Transform date and time.
|
||||
time/ctime.cpp
|
||||
Convert a time value to a date and time string.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
extern "C" char* ctime(const time_t* /*timep*/)
|
||||
// TODO: Gah, remove this as well when asctime is removed.
|
||||
extern "C" char* ctime(const time_t* clock)
|
||||
{
|
||||
return (char*) "ctime(3) is not implemented";
|
||||
return asctime(localtime(clock));
|
||||
}
|
31
libc/time/ctime_r.cpp
Normal file
31
libc/time/ctime_r.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
time/ctime_r.cpp
|
||||
Convert a time value to a date and time string.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
// TODO: Gah, remove this as well when asctime_r is removed.
|
||||
extern "C" char* ctime_r(const time_t* clock, char* buf)
|
||||
{
|
||||
return asctime_r(localtime(clock), buf);
|
||||
}
|
Loading…
Add table
Reference in a new issue