diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-02 21:01:38 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-02 21:01:38 +0100 |
commit | f7d30133221896638f7bf4f66c504255c4b14f48 (patch) | |
tree | 5f3e07a049f388a3a309a615b8884318f6668a98 /nsprpub/pr/tests/timemac.c | |
parent | 26b297510a11758727438df4669357a2a2bc42ce (diff) | |
download | UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.gz UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.lz UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.xz UXP-f7d30133221896638f7bf4f66c504255c4b14f48.zip |
Issue #1338 - Part 1: Update NSPR to 4.24
Diffstat (limited to 'nsprpub/pr/tests/timemac.c')
-rw-r--r-- | nsprpub/pr/tests/timemac.c | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/nsprpub/pr/tests/timemac.c b/nsprpub/pr/tests/timemac.c index f714aeb4f..b0f8b17d8 100644 --- a/nsprpub/pr/tests/timemac.c +++ b/nsprpub/pr/tests/timemac.c @@ -13,10 +13,11 @@ static char *dayOfWeek[] = - { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "???" }; +{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "???" }; static char *month[] = - { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "???" }; +{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "???" +}; static void printExplodedTime(const PRExplodedTime *et) { PRInt32 totalOffset; @@ -25,18 +26,18 @@ static void printExplodedTime(const PRExplodedTime *et) { /* Print day of the week, month, day, hour, minute, and second */ printf( "%s %s %ld %02ld:%02ld:%02ld ", - dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday, - et->tm_hour, et->tm_min, et->tm_sec); + dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday, + et->tm_hour, et->tm_min, et->tm_sec); /* Print time zone */ totalOffset = et->tm_params.tp_gmt_offset + et->tm_params.tp_dst_offset; if (totalOffset == 0) { - printf("UTC "); + printf("UTC "); } else { sign = ""; if (totalOffset < 0) { - totalOffset = -totalOffset; - sign = "-"; + totalOffset = -totalOffset; + sign = "-"; } hourOffset = totalOffset / 3600; minOffset = (totalOffset % 3600) / 60; @@ -52,58 +53,58 @@ int main(int argc, char** argv) PR_STDIO_INIT(); PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - - /* - ************************************************************* - ** - ** Testing PR_Now(), PR_ExplodeTime, and PR_ImplodeTime - ** on the current time - ** - ************************************************************* - */ + + /* + ************************************************************* + ** + ** Testing PR_Now(), PR_ExplodeTime, and PR_ImplodeTime + ** on the current time + ** + ************************************************************* + */ { - PRTime t1, t2; - PRExplodedTime et; + PRTime t1, t2; + PRExplodedTime et; - printf("*********************************************\n"); - printf("** **\n"); + printf("*********************************************\n"); + printf("** **\n"); printf("** Testing PR_Now(), PR_ExplodeTime, and **\n"); - printf("** PR_ImplodeTime on the current time **\n"); - printf("** **\n"); - printf("*********************************************\n\n"); + printf("** PR_ImplodeTime on the current time **\n"); + printf("** **\n"); + printf("*********************************************\n\n"); t1 = PR_Now(); /* First try converting to UTC */ PR_ExplodeTime(t1, PR_GMTParameters, &et); if (et.tm_params.tp_gmt_offset || et.tm_params.tp_dst_offset) { - printf("ERROR: UTC has nonzero gmt or dst offset.\n"); - return 1; + printf("ERROR: UTC has nonzero gmt or dst offset.\n"); + return 1; } printf("Current UTC is "); - printExplodedTime(&et); - printf("\n"); + printExplodedTime(&et); + printf("\n"); t2 = PR_ImplodeTime(&et); if (LL_NE(t1, t2)) { - printf("ERROR: Explode and implode are NOT inverse.\n"); - return 1; + printf("ERROR: Explode and implode are NOT inverse.\n"); + return 1; } /* Next, try converting to local (US Pacific) time */ PR_ExplodeTime(t1, PR_LocalTimeParameters, &et); printf("Current local time is "); - printExplodedTime(&et); - printf("\n"); - printf("GMT offset is %ld, DST offset is %ld\n", - et.tm_params.tp_gmt_offset, et.tm_params.tp_dst_offset); + printExplodedTime(&et); + printf("\n"); + printf("GMT offset is %ld, DST offset is %ld\n", + et.tm_params.tp_gmt_offset, et.tm_params.tp_dst_offset); t2 = PR_ImplodeTime(&et); if (LL_NE(t1, t2)) { - printf("ERROR: Explode and implode are NOT inverse.\n"); - return 1; - } + printf("ERROR: Explode and implode are NOT inverse.\n"); + return 1; + } } printf("Please examine the results\n"); |