![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/emscripten/tests/core/ |
Upload File : |
#include <time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { int result = 0; struct tm tm; memset(&tm, 0xaa, sizeof(tm)); /* Test we don't crash on uninitialized struct tm. Some fields might contain bogus values until everything needed is initialized, but we shouldn't crash. */ if (strptime("2007", "%Y", &tm) == NULL || strptime("12", "%d", &tm) == NULL || strptime("Feb", "%b", &tm) == NULL || strptime("13", "%M", &tm) == NULL || strptime("21", "%S", &tm) == NULL || strptime("16", "%H", &tm) == NULL) { printf("ERR: returned NULL"); exit(EXIT_FAILURE); } if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 || tm.tm_mday != 12 || tm.tm_mon != 1 || tm.tm_year != 107 || tm.tm_wday != 1 || tm.tm_yday != 42) { printf("ERR: unexpected tm content (1) - %d/%d/%d %d:%d:%d", tm.tm_mon + 1, tm.tm_mday, tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec); exit(EXIT_FAILURE); } if (strptime("8", "%d", &tm) == NULL) { printf("ERR: strptime failed"); exit(EXIT_FAILURE); } if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16 || tm.tm_mday != 8 || tm.tm_mon != 1 || tm.tm_year != 107 || tm.tm_wday != 4 || tm.tm_yday != 38) { printf("ERR: unexpected tm content (2) - %d/%d/%d %d:%d:%d", tm.tm_mon + 1, tm.tm_mday, tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec); exit(EXIT_FAILURE); } printf("OK"); }