2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved.
15 * Format a time-stamp.
17 * PUBLIC: char *__os_ctime __P((const time_t *, char *));
20 __os_ctime(tod, time_buf)
24 time_buf[CTIME_BUFLEN - 1] = '\0';
27 * The ctime_r interface is the POSIX standard, thread-safe version of
28 * ctime. However, it was implemented in three different ways (with
29 * and without a buffer length argument, and where the buffer length
30 * argument was an int vs. a size_t *). Also, you can't depend on a
31 * return of (char *) from ctime_r, HP-UX 10.XX's version returned an
34 #if defined(HAVE_VXWORKS)
36 size_t buflen = CTIME_BUFLEN;
37 (void)ctime_r(tod, time_buf, &buflen);
39 #elif defined(HAVE_CTIME_R_3ARG)
40 (void)ctime_r(tod, time_buf, CTIME_BUFLEN);
41 #elif defined(HAVE_CTIME_R)
42 (void)ctime_r(tod, time_buf);
44 (void)strncpy(time_buf, ctime(tod), CTIME_BUFLEN - 1);