aboutsummaryrefslogtreecommitdiff
path: root/cutils.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-10 19:36:39 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-10 19:36:39 +0000
commit3c6b20885dd6395882947e13901313a2fc291113 (patch)
tree8dbb67c5036e65015d8a93f649b1263aa000956c /cutils.c
parentda0b0df8c7c842670457088b12096ec63ea66fae (diff)
downloadqemu-3c6b20885dd6395882947e13901313a2fc291113.zip
qemu-3c6b20885dd6395882947e13901313a2fc291113.tar.gz
qemu-3c6b20885dd6395882947e13901313a2fc291113.tar.bz2
always use mktimegm
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3570 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/cutils.c b/cutils.c
index 074b5ac..7836a3e 100644
--- a/cutils.c
+++ b/cutils.c
@@ -81,3 +81,17 @@ int stristart(const char *str, const char *val, const char **ptr)
*ptr = p;
return 1;
}
+
+time_t mktimegm(struct tm *tm)
+{
+ time_t t;
+ int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday;
+ if (m < 3) {
+ m += 12;
+ y--;
+ }
+ t = 86400 * (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 +
+ y / 400 - 719469);
+ t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec;
+ return t;
+}