Skip to content

Commit

Permalink
date: use get_time() in datestamp()
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipwood committed Dec 19, 2024
1 parent d882f38 commit 23aca82
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,16 +1054,15 @@ void date_mode_release(struct date_mode *mode)

void datestamp(struct strbuf *out)
{
time_t now;
struct timeval now;
int offset;
struct tm tm = { 0 };

time(&now);
get_time(&now);

offset = tm_to_time_t(localtime_r(&now, &tm)) - now;
offset = tm_to_time_t(localtime_r(&now.tv_sec, &tm)) - now.tv_sec;
offset /= 60;

date_string(now, offset, out);
date_string(now.tv_sec, offset, out);
}

/*
Expand Down

0 comments on commit 23aca82

Please sign in to comment.