diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-07-18 19:47:20 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-07-18 19:47:20 +0000 |
commit | 81bc1d7af5886089bcd065382476f202ad7cc9ea (patch) | |
tree | 540f82bac3e6105b6fc34cd4b4613c1756a7512b /include | |
parent | b96fde308cd75eb17e5fdb0ea6d54c0f1f593ff9 (diff) |
Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/localtime.h | 24 | ||||
-rw-r--r-- | include/asterisk/options.h | 4 | ||||
-rw-r--r-- | include/asterisk/strings.h | 10 |
3 files changed, 32 insertions, 6 deletions
diff --git a/include/asterisk/localtime.h b/include/asterisk/localtime.h index e03c8b5b4..cf2256ee6 100644 --- a/include/asterisk/localtime.h +++ b/include/asterisk/localtime.h @@ -24,11 +24,27 @@ #ifndef _ASTERISK_LOCALTIME_H #define _ASTERISK_LOCALTIME_H +struct ast_tm { + int tm_sec; /* Seconds. [0-60] (1 leap second) */ + int tm_min; /* Minutes. [0-59] */ + int tm_hour; /* Hours. [0-23] */ + int tm_mday; /* Day. [1-31] */ + int tm_mon; /* Month. [0-11] */ + int tm_year; /* Year - 1900. */ + int tm_wday; /* Day of week. [0-6] */ + int tm_yday; /* Days in year.[0-365] */ + int tm_isdst; /* DST. [-1/0/1]*/ + long int tm_gmtoff; /* Seconds east of UTC. */ + char *tm_zone; /* Timezone abbreviation. */ + /* NOTE: do NOT reorder this final item. The order needs to remain compatible with struct tm */ + int tm_usec; /* microseconds */ +}; + int ast_tzsetwall(void); void ast_tzset(const char *name); -struct tm *ast_localtime(const time_t *timep, struct tm *p_tm, const char *zone); -time_t ast_mktime(struct tm * const tmp, const char *zone); -char *ast_ctime(const time_t * const timep); -char *ast_ctime_r(const time_t * const timep, char *buf); +struct ast_tm *ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone); +time_t ast_mktime(struct ast_tm * const tmp, const char *zone); +char *ast_ctime(const struct timeval * const timep, char *buf); +int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm); #endif /* _ASTERISK_LOCALTIME_H */ diff --git a/include/asterisk/options.h b/include/asterisk/options.h index a47c81ea8..d6541fe63 100644 --- a/include/asterisk/options.h +++ b/include/asterisk/options.h @@ -116,8 +116,8 @@ extern long option_minmemfree; /*!< Minimum amount of free system memory - stop #endif extern char defaultlanguage[]; -extern time_t ast_startuptime; -extern time_t ast_lastreloadtime; +extern struct timeval ast_startuptime; +extern struct timeval ast_lastreloadtime; extern pid_t ast_mainpid; extern char record_cache_dir[AST_CACHE_DIR_LEN]; diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 1b8733f50..8b0daab87 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -252,6 +252,16 @@ void ast_join(char *s, size_t len, char * const w[]); */ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed); +/* + \brief Parse a time (float) string. + \param src String to parse + \param dst Destination + \param _default Value to use if the string does not contain a valid time + \param consumed The number of characters 'consumed' in the string by the parse (see 'man sscanf' for details) + \return zero on success, non-zero on failure +*/ +int ast_get_timeval(const char *src, struct timeval *tv, struct timeval _default, int *consumed); + /*! * Support for dynamic strings. * |