projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove dependency on a file named "-lz"
[git.git]
/
date.c
diff --git
a/date.c
b/date.c
index
3e11500
..
1c1917b
100644
(file)
--- a/
date.c
+++ b/
date.c
@@
-123,8
+123,6
@@
static const struct {
{ "IDLE", +12, 0, }, /* International Date Line East */
};
{ "IDLE", +12, 0, }, /* International Date Line East */
};
-#define NR_TZ (sizeof(timezone_names) / sizeof(timezone_names[0]))
-
static int match_string(const char *date, const char *str)
{
int i = 0;
static int match_string(const char *date, const char *str)
{
int i = 0;
@@
-173,7
+171,7
@@
static int match_alpha(const char *date, struct tm *tm, int *offset)
}
}
}
}
- for (i = 0; i <
NR_TZ
; i++) {
+ for (i = 0; i <
ARRAY_SIZE(timezone_names)
; i++) {
int match = match_string(date, timezone_names[i].name);
if (match >= 3) {
int off = timezone_names[i].offset;
int match = match_string(date, timezone_names[i].name);
if (match >= 3) {
int off = timezone_names[i].offset;
@@
-326,7
+324,7
@@
static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
/*
* NOTE! We will give precedence to day-of-month over month or
/*
* NOTE! We will give precedence to day-of-month over month or
- * year num
e
bers in the 1-12 range. So 05 is always "mday 5",
+ * year numbers in the 1-12 range. So 05 is always "mday 5",
* unless we already have a mday..
*
* IOW, 01 Apr 05 parses as "April 1st, 2005".
* unless we already have a mday..
*
* IOW, 01 Apr 05 parses as "April 1st, 2005".
@@
-640,7
+638,7
@@
unsigned long approxidate(const char *date)
}
if (number > 0 && number < 32)
tm.tm_mday = number;
}
if (number > 0 && number < 32)
tm.tm_mday = number;
- if (tm.tm_mon > now.tm_mon)
+ if (tm.tm_mon > now.tm_mon
&& tm.tm_year == now.tm_year
)
tm.tm_year--;
return mktime(&tm);
}
tm.tm_year--;
return mktime(&tm);
}