int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
#ifndef REGTEST
-size_t strftime( char * restrict s, size_t maxsize, const char * restrict format, const struct tm * restrict timeptr )
+size_t strftime( char * _PDCLIB_restrict s, size_t maxsize, const char * _PDCLIB_restrict format, const struct tm * _PDCLIB_restrict timeptr )
{
+ /*
+ If the total number of resulting characters including the terminating null character is not
+ more than maxsize, the strftime function returns the number of characters placed
+ into the array pointed to by s not including the terminating null character.
+ (i.e., < maxsize)
+ */
+ size_t rc = 0;
+
+ while ( rc < maxsize )
+ {
+ if ( *format != '%' )
+ {
+ if ( ( *s++ = *format++ ) == '\0' )
+ {
+ return rc;
+ }
+ else
+ {
+ ++rc;
+ }
+ }
+ else
+ {
+ char flag = 0;
+ switch ( *++format )
+ {
+ case 'E':
+ case 'O':
+ flag = *format++;
+ break;
+ default:
+ /* EMPTY */
+ break;
+ }
+ switch( *format++ )
+ {
+ case 'a':
+ /* tm_wday abbreviated */
+ break;
+ case 'A':
+ /* tm_wday full */
+ break;
+ case 'b':
+ case 'h':
+ /* tm_mon abbreviated */
+ break;
+ case 'B':
+ /* tm_mon full */
+ break;
+ case 'c':
+ /* locale's date / time representation, %a %b %e %T %Y for C locale */
+ /* 'E' for locale's alternative representation */
+ break;
+ case 'C':
+ /* tm_year divided by 100, truncated to decimal (00-99) */
+ /* 'E' for base year (period) in locale's alternative representation */
+ break;
+ case 'd':
+ /* tm_mday as decimal (01-31) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'D':
+ /* %m/%d/%y */
+ break;
+ case 'e':
+ /* tm_mday as decimal ( 1-31) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'F':
+ /* %Y-%m-%d */
+ break;
+ case 'g':
+ /* last 2 digits of the week-based year as decimal (00-99) */
+ break;
+ case 'G':
+ /* week-based year as decimal (e.g. 1997) */
+ break;
+ case 'H':
+ /* tm_hour as 24h decimal (00-23) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'I':
+ /* tm_hour as 12h decimal (01-12) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'j':
+ /* tm_yday as decimal (001-366) */
+ break;
+ case 'm':
+ /* tm_mon as decimal (01-12) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'M':
+ /* tm_min as decimal (00-59) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'n':
+ /* newline */
+ break;
+ case 'p':
+ /* tm_hour locale's AM/PM designations */
+ break;
+ case 'r':
+ /* tm_hour / tm_min / tm_sec as locale's 12-hour clock time, %I:%M:%S %p for C locale */
+ break;
+ case 'R':
+ /* %H:%M */
+ break;
+ case 'S':
+ /* tm_sec as decimal (00-60) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 't':
+ /* tabulator */
+ break;
+ case 'T':
+ /* %H:%M:%S */
+ break;
+ case 'u':
+ /* tm_wday as decimal (1-7) with Monday == 1 */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'U':
+ /* week number of the year (first Sunday as the first day of week 1) as decimal (00-53) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'V':
+ /* week number as decimal (01-53) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'w':
+ /* tm_wday as decimal number (0-6) with Sunday == 0 */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'W':
+ /* week number of the year (first Monday as the first day of week 1) as decimal (00-53) */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'x':
+ /* locale's date representation, %m/%d/%y for C locale */
+ /* 'E' for locale's alternative representation */
+ break;
+ case 'X':
+ /* locale's time representation, %T for C locale */
+ /* 'E' for locale's alternative representation */
+ break;
+ case 'y':
+ /* last 2 digits of tm_year as decimal (00-99) */
+ /* 'E' for offset from %EC (year only) in locale's alternative representation */
+ /* 'O' for locale's alternative numeric symbols */
+ break;
+ case 'Y':
+ /* tm_year as decimal (e.g. 1997) */
+ /* 'E' for locale's alternative representation */
+ break;
+ case 'z':
+ /* tm_isdst / UTC offset in ISO8601 format (e.g. -0430 meaning 4 hours 30 minutes behind Greenwich), or no characters */
+ break;
+ case 'Z':
+ /* tm_isdst / locale's time zone name or abbreviation, or no characters */
+ break;
+ case '%':
+ /* '%' character */
+ break;
+ }
+ }
+ }
+
return 0;
}
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
int main( void )
{
- return NO_TESTDRIVER;
+ TESTCASE( NO_TESTDRIVER );
+ return TEST_RESULTS;
}
#endif
{
struct _PDCLIB_ctype_t * ctype; /* internal <ctype.h> information */
char * _PDCLIB_errno_texts[_PDCLIB_ERRNO_MAX]; /* strerror() / perror() */
+ char * _PDCLIB_month_name_abbr[12]; /* month names, abbreviated */
+ char * _PDCLIB_month_name_full[12]; /* month names, full */
+ char * _PDCLIB_day_name_abbr[7]; /* weekday names, abbreviated */
+ char * _PDCLIB_day_name_full[7]; /* weekday names, full */
char * decimal_point; /* decimal point character */
char * thousands_sep; /* character for seperating groups of digits */
char * grouping; /* string indicating the size of digit groups */
Returns -1 if the value cannot be represented in the return type or is
not available.
*/
-clock_t clock( void ) _PDCLIB_nothrow;
+clock_t clock( void );
/* Returns the difference between two calendar times in seconds. */
-double difftime( time_t time1, time_t time0 ) _PDCLIB_nothrow;
+double difftime( time_t time1, time_t time0 );
/* Normalizes the values in the broken-down time pointed to by timeptr.
Returns the calender time specified by the broken-down time.
*/
-time_t mktime( struct tm * timeptr ) _PDCLIB_nothrow;
+time_t mktime( struct tm * timeptr );
/* Returns the current calender time. If timer is not a NULL pointer, stores
the current calender time at that address as well.
*/
-time_t time( time_t * timer ) _PDCLIB_nothrow;
+time_t time( time_t * timer );
/* Sets the interval pointed to by ts to the current calender time, based
on the specified base.
Returns base, if successful, otherwise zero.
*/
-int timespec_get( struct timespec * ts, int base ) _PDCLIB_nothrow;
+int timespec_get( struct timespec * ts, int base );
/* Converts the broken-down time pointed to by timeptr into a string in the
form "Sun Sep 16 01:03:52 1973\n\0".
*/
-char * asctime( const struct tm * timeptr ) _PDCLIB_nothrow;
+char * asctime( const struct tm * timeptr );
/* Equivalent to asctime( localtime( timer ) ). */
-char * ctime( const time_t * timer ) _PDCLIB_nothrow;
+char * ctime( const time_t * timer );
/* Converts the calender time pointed to by timer into a broken-down time
expressed as UTC.
Returns a pointer to the broken-down time, or a NULL pointer if it
cannot be represented.
*/
-struct tm * gmtime( const time_t * timer ) _PDCLIB_nothrow;
+struct tm * gmtime( const time_t * timer );
/* Converts the calender time pointed to by timer into a broken-down time
expressed as local time.
Returns a pointer to the broken-down time, or a NULL pointer if if
cannot be represented.
*/
-struct tm * localtime( const time_t * timer ) _PDCLIB_nothrow;
+struct tm * localtime( const time_t * timer );
/* Writes the broken-down time pointed to by timeptr into the character
array pointed to by s. The string pointed to by format controls the
struct _PDCLIB_file_t * next; /* Pointer to next struct (internal) */
};
+/* -------------------------------------------------------------------------- */
+/* Various <time.h> internals */
+/* -------------------------------------------------------------------------- */
+
+typedef _PDCLIB_time _PDCLIB_time_t;
+typedef _PDCLIB_clock _PDCLIB_clock_t;
+
/* -------------------------------------------------------------------------- */
/* Internal data types */
/* -------------------------------------------------------------------------- */
/* EDOM */ (char *)"EDOM (Domain error)",
/* EILSEQ */ (char *)"EILSEQ (Illegal sequence)"
},
+ /* _PDCLIB_month_name_abbr */
+ {
+ (char *)"Jan",
+ (char *)"Feb",
+ (char *)"Mar",
+ (char *)"Apr",
+ (char *)"May",
+ (char *)"Jun",
+ (char *)"Jul",
+ (char *)"Aug",
+ (char *)"Sep",
+ (char *)"Oct",
+ (char *)"Now",
+ (char *)"Dec"
+ },
+ /* _PDCLIB_month_name_full */
+ {
+ (char *)"January",
+ (char *)"February",
+ (char *)"March",
+ (char *)"April",
+ (char *)"May",
+ (char *)"June",
+ (char *)"July",
+ (char *)"August",
+ (char *)"September",
+ (char *)"October",
+ (char *)"November",
+ (char *)"December"
+ },
+ /* _PDCLIB_day_name_abbr */
+ {
+ (char *)"Sun",
+ (char *)"Mon",
+ (char *)"Tue",
+ (char *)"Wed",
+ (char *)"Thu",
+ (char *)"Fri",
+ (char *)"Sat"
+ },
+ /* _PDCLIB_day_name_full */
+ {
+ (char *)"Sunday",
+ (char *)"Monday",
+ (char *)"Tuesday",
+ (char *)"Wednesday",
+ (char *)"Thursday",
+ (char *)"Friday",
+ (char *)"Saturday"
+ },
/* decimal_point */ (char *)".",
/* thousands_sep */ (char *)"",
/* grouping */ (char *)"",
_PDCLIB_intmax rem;
};
+/* -------------------------------------------------------------------------- */
+/* Time types */
+/* -------------------------------------------------------------------------- */
+
+#define _PDCLIB_time long
+
+#define _PDCLIB_clock long
+#define _PDCLIB_CLOCKS_PER_SEC 1000000
+
+#define _PDCLIB_TIME_UTC 1
+
/* -------------------------------------------------------------------------- */
/* Floating Point */
/* -------------------------------------------------------------------------- */