From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 04/18] date.c: mark file-local function static
Date: Tue, 12 Jan 2010 10:43:36 +0100 [thread overview]
Message-ID: <4B4C4448.9060908@viscovery.net> (raw)
In-Reply-To: <7vr5pv3d7w.fsf@alter.siamese.dyndns.org>
Junio C Hamano schrieb:
> Johannes Sixt <j.sixt@viscovery.net> writes:
>> This one is used from compat/mingw.c for the gettimeofday emulation.
>> Please leave it extern.
I'll add this patch to may windows-update series to avoids this hack.
--- 8< ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] compat/mingw.c: do not use tm_to_time_t from date.c
To implement gettimeofday(), a broken-down UTC time was requested from the
system using GetSystemTime() and converted using tm_to_time_t() because it
does not look at the current timezone, which mktime() would do. But
meanwhile we have grown infrastructure in mingw.c, so that we can use a
different conversion path. This way we can avoid the ugly back-reference
from the compatibility layer to the generic git code.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
compat/mingw.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index faaaade..3c78f39 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -281,19 +281,11 @@ int mkstemp(char *template)
int gettimeofday(struct timeval *tv, void *tz)
{
- 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 = tm_to_time_t(&tm);
- if (tv->tv_sec < 0)
- return -1;
- tv->tv_usec = st.wMilliseconds*1000;
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ tv->tv_sec = filetime_to_time_t(&ft);
+ /* the unit is 100-nanoseconds, ie., a 10th of a microsecond */
+ tv->tv_usec = (ft.dwLowDateTime % 10000000) / 10;
return 0;
}
--
1.6.6.1207.g714a1.dirty
next prev parent reply other threads:[~2010-01-12 9:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 7:52 [PATCH 00/18] mark file-local symbols static Junio C Hamano
2010-01-12 7:52 ` [PATCH 01/18] bisect.c: mark file-local function static Junio C Hamano
2010-01-12 7:52 ` [PATCH 02/18] builtin-rev-list.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 03/18] pretty.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 04/18] date.c: " Junio C Hamano
2010-01-12 8:37 ` Johannes Sixt
2010-01-12 9:05 ` Junio C Hamano
2010-01-12 9:43 ` Johannes Sixt [this message]
2010-01-12 7:52 ` [PATCH 05/18] http.c: mark file-local functions static Junio C Hamano
2010-01-12 7:52 ` [PATCH 06/18] entry.c: mark file-local function static Junio C Hamano
2010-01-12 7:52 ` [PATCH 07/18] parse-options.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 08/18] read-cache.c: mark file-local functions static Junio C Hamano
2010-01-12 7:52 ` [PATCH 09/18] remote-curl.c: mark file-local function static Junio C Hamano
2010-01-12 7:52 ` [PATCH 10/18] quote.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 11/18] submodule.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 12/18] utf8.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 13/18] mailmap.c: remove unused function Junio C Hamano
2010-01-12 7:52 ` [PATCH 14/18] sha1_file.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 15/18] strbuf.c: " Junio C Hamano
2010-01-12 7:52 ` [PATCH 16/18] blob.c: " Junio C Hamano
2010-01-12 17:37 ` Daniel Barkalow
2010-01-13 6:56 ` Junio C Hamano
2010-01-12 7:53 ` [PATCH 17/18] object.c: remove unused functions Junio C Hamano
2010-01-12 7:53 ` [PATCH 18/18] symlinks.c: " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4C4448.9060908@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.