mirror of
https://github.com/git/git.git
synced 2026-03-14 02:43:25 +01:00
Rename my_mktime() to tm_to_time_t() and make it officially extern.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
@@ -218,7 +218,6 @@ 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);
|
||||
@@ -228,7 +227,7 @@ int gettimeofday(struct timeval *tv, void *tz)
|
||||
tm.tm_hour = st.wHour;
|
||||
tm.tm_min = st.wMinute;
|
||||
tm.tm_sec = st.wSecond;
|
||||
tv->tv_sec = my_mktime(&tm);
|
||||
tv->tv_sec = tm_to_time_t(&tm);
|
||||
if (tv->tv_sec < 0)
|
||||
return -1;
|
||||
tv->tv_usec = st.wMilliseconds*1000;
|
||||
|
||||
13
date.c
13
date.c
@@ -6,7 +6,10 @@
|
||||
|
||||
#include "cache.h"
|
||||
|
||||
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
|
||||
@@ -67,7 +70,7 @@ static int local_tzoffset(unsigned long time)
|
||||
|
||||
t = time;
|
||||
localtime_r(&t, &tm);
|
||||
t_local = my_mktime(&tm);
|
||||
t_local = tm_to_time_t(&tm);
|
||||
|
||||
if (t_local < t) {
|
||||
eastwest = -1;
|
||||
@@ -322,7 +325,7 @@ static int is_date(int year, int month, int day, struct tm *now_tm, time_t now,
|
||||
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
|
||||
@@ -572,7 +575,7 @@ int parse_date(const char *date, char *result, int maxlen)
|
||||
}
|
||||
|
||||
/* mktime uses local timezone */
|
||||
then = my_mktime(&tm);
|
||||
then = tm_to_time_t(&tm);
|
||||
if (offset == -1)
|
||||
offset = (then - mktime(&tm)) / 60;
|
||||
|
||||
@@ -611,7 +614,7 @@ void datestamp(char *buf, int bufsize)
|
||||
|
||||
time(&now);
|
||||
|
||||
offset = my_mktime(localtime(&now)) - now;
|
||||
offset = tm_to_time_t(localtime(&now)) - now;
|
||||
offset /= 60;
|
||||
|
||||
date_string(now, offset, buf, bufsize);
|
||||
|
||||
@@ -143,6 +143,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user