123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- #ifndef BASE_PRTIME_H__
- #define BASE_PRTIME_H__
- #include <stdint.h>
- #include "base/base_export.h"
- typedef int8_t PRInt8;
- typedef int16_t PRInt16;
- typedef int32_t PRInt32;
- typedef int64_t PRInt64;
- typedef int PRIntn;
- typedef PRIntn PRBool;
- #define PR_TRUE 1
- #define PR_FALSE 0
- typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
- #define PR_ASSERT DCHECK
- #define PR_CALLBACK
- #define PR_INT16_MAX 32767
- #define NSPR_API(__type) extern __type
- #define LL_I2L(l, i) ((l) = (PRInt64)(i))
- #define LL_MUL(r, a, b) ((r) = (a) * (b))
- #define LL_ADD(r, a, b) ((r) = (a) + (b))
- #define LL_SUB(r, a, b) ((r) = (a) - (b))
- #define PR_MSEC_PER_SEC 1000UL
- #define PR_USEC_PER_SEC 1000000UL
- #define PR_NSEC_PER_SEC 1000000000UL
- #define PR_USEC_PER_MSEC 1000UL
- #define PR_NSEC_PER_MSEC 1000000UL
- typedef PRInt64 PRTime;
- typedef struct PRTimeParameters {
- PRInt32 tp_gmt_offset;
- PRInt32 tp_dst_offset;
- } PRTimeParameters;
- typedef struct PRExplodedTime {
- PRInt32 tm_usec;
- PRInt32 tm_sec;
-
- PRInt32 tm_min;
- PRInt32 tm_hour;
- PRInt32 tm_mday;
- PRInt32 tm_month;
- PRInt16 tm_year;
- PRInt8 tm_wday;
- PRInt16 tm_yday;
- PRTimeParameters tm_params;
- } PRExplodedTime;
- typedef PRTimeParameters (PR_CALLBACK *PRTimeParamFn)(const PRExplodedTime *gmt);
- NSPR_API(PRTime)
- PR_ImplodeTime(const PRExplodedTime *exploded);
- NSPR_API(void) PR_NormalizeTime(
- PRExplodedTime *exploded, PRTimeParamFn params);
- NSPR_API(PRTimeParameters) PR_GMTParameters(const PRExplodedTime *gmt);
- BASE_EXPORT PRStatus PR_ParseTimeString (
- const char *string,
- PRBool default_to_gmt,
- PRTime *result);
- #endif
|