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
TLS: PIPELINING under OpenSSL
[exim.git]
/
src
/
src
/
tod.c
diff --git
a/src/src/tod.c
b/src/src/tod.c
index 2077111703deb842e067ce2d07c8973b85b49a42..5f451ba96de445e6b52a60b01f5a04a9ed4bc8dd 100644
(file)
--- a/
src/src/tod.c
+++ b/
src/src/tod.c
@@
-1,10
+1,8
@@
-/* $Cambridge: exim/src/src/tod.c,v 1.5 2009/11/16 19:50:37 nm4 Exp $ */
-
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 20
09
*/
+/* Copyright (c) University of Cambridge 1995 - 20
14
*/
/* See the file NOTICE for conditions of use and distribution. */
/* A function for returning the time of day in various formats */
/* See the file NOTICE for conditions of use and distribution. */
/* A function for returning the time of day in various formats */
@@
-36,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
@@
-53,9
+52,20
@@
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);
+ /* Unix epoch/usec format */
+ (void) sprintf(CS timebuf, TIME_T_FMT "%06ld", tv.tv_sec, (long) tv.tv_usec );
+ 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;
@@
-64,8
+74,8
@@
if (type == tod_log) type = log_timezone? tod_log_zone : tod_log_bare;
else if (type == tod_epoch)
{
else if (type == tod_epoch)
{
- (void) sprintf(CS timebuf,
"%d", (int)
now); /* Unix epoch format */
- return timebuf;
+ (void) sprintf(CS timebuf,
TIME_T_FMT,
now); /* Unix epoch format */
+ return timebuf;
/* NB the above will be wrong if time_t is FP */
}
else if (type == tod_zulu)
}
else if (type == tod_zulu)