For this purpose we make my_mktime of date.c public and use it to convert
a struct tm to a time_t.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
compat/mingw.c | 14 ++++++++++++++
date.c | 2 +-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index 71bca96..24f783b 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -38,6 +38,20 @@ int mkstemp(char *template)
int gettimeofday(struct timeval *tv, void *tz)
{
+ extern time_t my_mktime(struct tm *tm);
+ SYSTEMTIME st;
+ struct tm tm;
+ GetSystemTime(&st);
+ tm.tm_year = st.wYear-1900;
+ tm.tm_mon = st.wMonth-1;
+ tm.tm_mday = st.wDay;
+ tm.tm_hour = st.wHour;
+ tm.tm_min = st.wMinute;
+ tm.tm_sec = st.wSecond;
+ tv->tv_sec = my_mktime(&tm);
+ if (tv->tv_sec < 0)
+ return -1;
+ tv->tv_usec = st.wMilliseconds*1000;
return 0;
}
diff --git a/date.c b/date.c
index 8f70500..9c16eae 100644
--- a/date.c
+++ b/date.c
@@ -6,7 +6,7 @@
#include "cache.h"
-static time_t my_mktime(struct tm *tm)
+time_t my_mktime(struct tm *tm)
{
static const int mdays[] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
--
1.5.4.1.126.ge5a7d
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Ingo Molnar | Re: [PATCH 00/34] AMD IOMMU driver |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Ryan Hope | reiser4 for 2.6.27-rc1 |
git: | |
| Linus Torvalds | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Jon Smirl | Re: VCS comparison table |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Dmitry Kakurin | Re: Git on MSys (or how to make it easy for Windows users to compile git) |
| Octavian Purdila | race in skb_splice_bits? |
| Wolfgang Walter | Re: Kernel oops with 2.6.26, padlock and ipsec: probably problem with fpu state ch... |
| Ingo Molnar | Re: [bug, netconsole, SLUB] BUG skbuff_head_cache: Poison overwritten |
| Rick Jones | Re: 2.6.24 BUG: soft lockup - CPU#X |
| Richard Stallman | Real men don't attack straw men |
| chefren | Kuro5hin: OpenBSD Founder Theo deRaadt Has Conflict of Interest With AMD |
| Pieter Verberne | File collision while using pkg_add |
| Jason Dixon | Re: Hardware recommendation for firewalls (more than 4 NICs) |
