js/src/prmjtime.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/prmjtime.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef prmjtime_h
    1.11 +#define prmjtime_h
    1.12 +
    1.13 +#include <stddef.h>
    1.14 +#include <stdint.h>
    1.15 +
    1.16 +/*
    1.17 + * Broken down form of 64 bit time value.
    1.18 + */
    1.19 +struct PRMJTime {
    1.20 +    int32_t tm_usec;            /* microseconds of second (0-999999) */
    1.21 +    int8_t tm_sec;              /* seconds of minute (0-59) */
    1.22 +    int8_t tm_min;              /* minutes of hour (0-59) */
    1.23 +    int8_t tm_hour;             /* hour of day (0-23) */
    1.24 +    int8_t tm_mday;             /* day of month (1-31) */
    1.25 +    int8_t tm_mon;              /* month of year (0-11) */
    1.26 +    int8_t tm_wday;             /* 0=sunday, 1=monday, ... */
    1.27 +    int32_t tm_year;            /* absolute year, AD */
    1.28 +    int16_t tm_yday;            /* day of year (0 to 365) */
    1.29 +    int8_t tm_isdst;            /* non-zero if DST in effect */
    1.30 +};
    1.31 +
    1.32 +/* Some handy constants */
    1.33 +#define PRMJ_USEC_PER_SEC       1000000L
    1.34 +#define PRMJ_USEC_PER_MSEC      1000L
    1.35 +
    1.36 +/* Return the current local time in micro-seconds */
    1.37 +extern int64_t
    1.38 +PRMJ_Now(void);
    1.39 +
    1.40 +/* Release the resources associated with PRMJ_Now; don't call PRMJ_Now again */
    1.41 +#if defined(JS_THREADSAFE) && defined(XP_WIN)
    1.42 +extern void
    1.43 +PRMJ_NowShutdown(void);
    1.44 +#else
    1.45 +#define PRMJ_NowShutdown()
    1.46 +#endif
    1.47 +
    1.48 +/* Format a time value into a buffer. Same semantics as strftime() */
    1.49 +extern size_t
    1.50 +PRMJ_FormatTime(char *buf, int buflen, const char *fmt, PRMJTime *tm);
    1.51 +
    1.52 +#endif /* prmjtime_h */

mercurial