diff options
author | Bruce Guenter <bruce@untroubled.org> | 2007-10-12 10:29:34 -0600 |
---|---|---|
committer | Bruce Guenter <bruce@untroubled.org> | 2009-10-19 11:04:33 -0600 |
commit | 5ac20a731071d2c2c7f10171a07a4eddce56c76c (patch) | |
tree | fb238dfe5a30acda2830e14555d5143b513e1c65 /lib | |
parent | 2752949f790f1f11ff532a97da954e72b9fe3a69 (diff) |
Allow make_date to use timestamps other than now.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/makefield.cc | 5 | ||||
-rw-r--r-- | lib/makefield.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/makefield.cc b/lib/makefield.cc index 34bb092..ecf31ac 100644 --- a/lib/makefield.cc +++ b/lib/makefield.cc @@ -26,10 +26,11 @@ #include "itoa.h" #include "mystring/mystring.h" -mystring make_date() +mystring make_date(time_t t) { char buf[256]; - time_t t = time(0); + if (t == 0) + t = time(0); struct tm* l = localtime(&t); strftime(buf, 256, "%a, %d %b %Y %H:%M:%S ", l); #ifdef TM_HAS_GMTOFF diff --git a/lib/makefield.h b/lib/makefield.h index a73ddc4..9686ef2 100644 --- a/lib/makefield.h +++ b/lib/makefield.h @@ -1,7 +1,7 @@ #ifndef NULLMAILER__MAKEFIELD__H__ #define NULLMAILER__MAKEFIELD__H__ -extern mystring make_date(); +extern mystring make_date(time_t t = 0); extern mystring make_messageid(const mystring& idhost); extern mystring make_boundary(); |