/* ****************************************************************************** * SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipcom_ctime.c,v $ $Revision: 1.6 $ * $Source: /home/interpeak/CVSRoot/ipcom/port/src/ipcom_ctime.c,v $ * $Author: lob $ $Date: 2004-09-01 18:06:49 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Lennart Bang ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipcom_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #define IPCOM_USE_CLIB_PROTO #include "ipcom_clib.h" #include "ipcom_time.h" /* **************************************************************************** * 4 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 5 DEFINES **************************************************************************** */ /* **************************************************************************** * 6 TYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 LOCAL FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 10 PUBLIC FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipcom_asctime_r *=========================================================================== * Description: * Parameters: * Returns: * */ #if defined(IPCOM_ASCTIME_R) && IPCOM_ASCTIME_R == 1 IP_PUBLIC char * ipcom_asctime_r(const struct Ip_tm *tm, char *buf) { static const char *day_name[8] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "ERR" }; static const char *month_name[13] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "ERR" }; ipcom_sprintf(buf, "%s %s %02d %02d:%02d:%02d %04d\n", day_name[IP_MIN(tm->tm_wday, 7)], month_name[IP_MIN(tm->tm_mon, 12)], tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_year + 1900); return buf; } #endif /* *=========================================================================== * ipcom_asctime *=========================================================================== * Description: * Parameters: * Returns: * */ #if defined(IPCOM_ASCTIME) && IPCOM_ASCTIME == 1 IP_PUBLIC char * ipcom_asctime(const struct Ip_tm *tm) { static char buf[26]; return ipcom_asctime_r(tm, (char *)buf); } #endif /* *=========================================================================== * ipcom_ctime_r *=========================================================================== * Description: * Parameters: * Returns: * */ #if defined(IPCOM_CTIME_R) && IPCOM_CTIME_R == 1 IP_PUBLIC char * ipcom_ctime_r(const Ip_time_t *timep, char *buf) { struct Ip_tm tm; return ipcom_asctime_r(ipcom_localtime_r(timep, &tm), buf); } #endif /* *=========================================================================== * ipcom_ctime *=========================================================================== * Description: * Parameters: * Returns: * */ #if defined(IPCOM_CTIME) && IPCOM_CTIME == 1 IP_PUBLIC char * ipcom_ctime(const Ip_time_t *timep) { static char buf[26]; return ipcom_ctime_r(timep, (char *)buf); } #endif /* **************************************************************************** * END OF FILE **************************************************************************** */