From 70622ee748e81cb02be433337ba19425c22fe531 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Tue, 14 Sep 2010 21:24:25 +0000 Subject: [PATCH] * src/lib/Makefile.am: * src/lib/Evil.h: * src/lib/evil_time.c: * src/lib/evil_time.h: add locatime_r() for calendar in Elementary. SVN revision: 52263 --- legacy/evil/ChangeLog | 8 +++++++ legacy/evil/src/lib/Evil.h | 2 ++ legacy/evil/src/lib/Makefile.am | 2 ++ legacy/evil/src/lib/evil_time.c | 32 +++++++++++++++++++++++++ legacy/evil/src/lib/evil_time.h | 42 +++++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 legacy/evil/src/lib/evil_time.c create mode 100644 legacy/evil/src/lib/evil_time.h diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index fbaadda9dd..5514b0c0af 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,11 @@ +2010-09-14 Vincent Torri + + * src/lib/Makefile.am: + * src/lib/Evil.h: + * src/lib/evil_time.c: + * src/lib/evil_time.h: + add locatime_r() for calendar in Elementary. + 2010-05-29 Vincent Torri * doc/Doxyfile: diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index eb655ce029..cdbaa77400 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -65,6 +65,7 @@ extern "C" { #include #include #include +#include #include #include #include @@ -117,6 +118,7 @@ typedef unsigned long gid_t; #include "evil_stdlib.h" #include "evil_stdio.h" #include "evil_string.h" +#include "evil_time.h" #include "evil_unistd.h" #include "evil_util.h" diff --git a/legacy/evil/src/lib/Makefile.am b/legacy/evil/src/lib/Makefile.am index edc0258cb2..9666fb2e92 100644 --- a/legacy/evil/src/lib/Makefile.am +++ b/legacy/evil/src/lib/Makefile.am @@ -14,6 +14,7 @@ evil_main.h \ evil_stdlib.h \ evil_stdio.h \ evil_string.h \ +evil_time.h \ evil_unistd.h \ evil_util.h @@ -38,6 +39,7 @@ evil_pwd.c \ evil_stdlib.c \ evil_stdio.c \ evil_string.c \ +evil_time.c \ evil_unistd.c \ evil_util.c \ evil_uuid.c diff --git a/legacy/evil/src/lib/evil_time.c b/legacy/evil/src/lib/evil_time.c new file mode 100644 index 0000000000..80fbae1569 --- /dev/null +++ b/legacy/evil/src/lib/evil_time.c @@ -0,0 +1,32 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include "Evil.h" +#include "evil_private.h" + + +struct tm * +localtime_r(const time_t *timep, struct tm *result) +{ +#ifndef _MSC_VER + struct tm *tmp; +#endif /* ! _MSC_VER */ + + if (!timep || !result) + return NULL; + +#ifdef _MSC_VER + if (localtime_s(result, timep) != 0) + return NULL; +#else + tmp = localtime(timep); + if (!tmp) + return NULL; + + memcpy(result, tmp, sizeof(struct tm)); + +#endif /* ! _MSC_VER */ + + return result; +} diff --git a/legacy/evil/src/lib/evil_time.h b/legacy/evil/src/lib/evil_time.h new file mode 100644 index 0000000000..1594c77ef6 --- /dev/null +++ b/legacy/evil/src/lib/evil_time.h @@ -0,0 +1,42 @@ +#ifndef __EVIL_TIME_H__ +#define __EVIL_TIME_H__ + + +/** + * @file evil_time.h + * @brief The file that provides functions ported from Unix in time.h. + * @defgroup Evil_Time_Group Time.h functions + * + * This header provides functions ported from Unix in time.h. + * + * @{ + */ + + +/** + * @brief Convert the calendar time to broken-time representation in a + * user supplied data. + * + * @param timep The calender time. + * @param result The broken-down time representation. + * @return The broken-down time representation. + * + * This function converts the calendar time @p timep to a broken-time + * representation. The result is stored in the buffer @p result + * supplied by the user. If @p timep or @p result are @c NULL, or if + * an error occurred, this function returns @c NULL and the values in + * @p result might be undefined. Otherwise it returns @p result. + * + * Conformity: Non applicable. + * + * Supported OS: Windows XP. + */ +EAPI struct tm *localtime_r(const time_t *timep, struct tm *result); + + +/** + * @} + */ + + +#endif /* __EVIL_TIME_H__ */