summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ea9e98c)
raw | patch | inline | side by side (parent: ea9e98c)
author | Johannes Sixt <johannes.sixt@telecom.at> | |
Mon, 23 Jun 2008 06:31:41 +0000 (08:31 +0200) | ||
committer | Johannes Sixt <johannes.sixt@telecom.at> | |
Mon, 23 Jun 2008 11:40:29 +0000 (13:40 +0200) |
We will use it from the MinGW port's gettimeofday() substitution.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
date.c | patch | blob | history | |
git-compat-util.h | patch | blob | history |
index 1a4eb87b01d5dab0c4a0c455bbef3fda132415ee..35a52576c53e5e1406d40ed4402b8834a29b9f0e 100644 (file)
--- a/date.c
+++ b/date.c
#include "cache.h"
-static time_t my_mktime(struct tm *tm)
+/*
+ * This is like mktime, but without normalization of tm_wday and tm_yday.
+ */
+time_t tm_to_time_t(const struct tm *tm)
{
static const int mdays[] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
t = time;
localtime_r(&t, &tm);
- t_local = my_mktime(&tm);
+ t_local = tm_to_time_t(&tm);
if (t_local < t) {
eastwest = -1;
if (!now_tm)
return 1;
- specified = my_mktime(r);
+ specified = tm_to_time_t(r);
/* Be it commit time or author time, it does not make
* sense to specify timestamp way into the future. Make
}
/* mktime uses local timezone */
- then = my_mktime(&tm);
+ then = tm_to_time_t(&tm);
if (offset == -1)
offset = (then - mktime(&tm)) / 60;
time(&now);
- offset = my_mktime(localtime(&now)) - now;
+ offset = tm_to_time_t(localtime(&now)) - now;
offset /= 60;
date_string(now, offset, buf, bufsize);
diff --git a/git-compat-util.h b/git-compat-util.h
index a9a85be89d69c91afcde3530325494dffbdf48b1..58cdc087fac4aa266b1a8c3959b44bbdbcef33f2 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -147,6 +147,7 @@ extern void set_error_routine(void (*routine)(const char *err, va_list params));
extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
extern int prefixcmp(const char *str, const char *prefix);
+extern time_t tm_to_time_t(const struct tm *tm);
#ifdef NO_MMAP