git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support expansion variable for hi-res timestamp (bug 1172).
[exim.git]
/
src
/
src
/
tod.c
diff --git
a/src/src/tod.c
b/src/src/tod.c
index c6afb713eb2bd1706e9100ebe8d0d9c6d8d27583..9aa845c822b706596a3653ecd0450de460f7213a 100644
(file)
--- a/
src/src/tod.c
+++ b/
src/src/tod.c
@@
-34,6
+34,7
@@
option.
Argument: type of timestamp required:
tod_bsdin BSD inbox format
tod_epoch Unix epoch format
Argument: type of timestamp required:
tod_bsdin BSD inbox format
tod_epoch Unix epoch format
+ tod_epochl Unix epoch/usec format
tod_full full date and time
tod_log log file data line format,
with zone if log_timezone is TRUE
tod_full full date and time
tod_log log file data line format,
with zone if log_timezone is TRUE
@@
-51,9
+52,19
@@
Returns: pointer to fixed buffer containing the timestamp
uschar *
tod_stamp(int type)
{
uschar *
tod_stamp(int type)
{
-time_t now
= time(NULL)
;
+time_t now;
struct tm *t;
struct tm *t;
+if (type == tod_epoch_l)
+ {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ (void) sprintf(CS timebuf, "%ld%06ld", tv.tv_sec, tv.tv_usec ); /* Unix epoch/usec format */
+ return timebuf;
+ }
+
+now = time(NULL);
+
/* Vary log type according to timezone requirement */
if (type == tod_log) type = log_timezone? tod_log_zone : tod_log_bare;
/* Vary log type according to timezone requirement */
if (type == tod_log) type = log_timezone? tod_log_zone : tod_log_bare;