michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef prmjtime_h michael@0: #define prmjtime_h michael@0: michael@0: #include michael@0: #include michael@0: michael@0: /* michael@0: * Broken down form of 64 bit time value. michael@0: */ michael@0: struct PRMJTime { michael@0: int32_t tm_usec; /* microseconds of second (0-999999) */ michael@0: int8_t tm_sec; /* seconds of minute (0-59) */ michael@0: int8_t tm_min; /* minutes of hour (0-59) */ michael@0: int8_t tm_hour; /* hour of day (0-23) */ michael@0: int8_t tm_mday; /* day of month (1-31) */ michael@0: int8_t tm_mon; /* month of year (0-11) */ michael@0: int8_t tm_wday; /* 0=sunday, 1=monday, ... */ michael@0: int32_t tm_year; /* absolute year, AD */ michael@0: int16_t tm_yday; /* day of year (0 to 365) */ michael@0: int8_t tm_isdst; /* non-zero if DST in effect */ michael@0: }; michael@0: michael@0: /* Some handy constants */ michael@0: #define PRMJ_USEC_PER_SEC 1000000L michael@0: #define PRMJ_USEC_PER_MSEC 1000L michael@0: michael@0: /* Return the current local time in micro-seconds */ michael@0: extern int64_t michael@0: PRMJ_Now(void); michael@0: michael@0: /* Release the resources associated with PRMJ_Now; don't call PRMJ_Now again */ michael@0: #if defined(JS_THREADSAFE) && defined(XP_WIN) michael@0: extern void michael@0: PRMJ_NowShutdown(void); michael@0: #else michael@0: #define PRMJ_NowShutdown() michael@0: #endif michael@0: michael@0: /* Format a time value into a buffer. Same semantics as strftime() */ michael@0: extern size_t michael@0: PRMJ_FormatTime(char *buf, int buflen, const char *fmt, PRMJTime *tm); michael@0: michael@0: #endif /* prmjtime_h */