Closed ghiboz closed 3 days ago
Commit datetime gets from git log --pretty=format:"%ct"
, which outputs the Unix timestamp of commit time, and converts to the local time zone of your PC by this code:
public string CommitterTimeStr => _utcStart.AddSeconds(CommitterTime).ToString("yyyy/MM/dd HH:mm:ss");
public string CommitterTimeShortStr => _utcStart.AddSeconds(CommitterTime).ToString("yyyy/MM/dd");
private static readonly DateTime _utcStart = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime();
I don't know if the algorithm is wrong.
I don't know if the algorithm is wrong.
It may be because your _utcStart
is converted to local time when it is initialized, instead of converting the calculated target time to local time. Daylight saving time changes will not be reflected in the UTC timestamp 0.
I don't know if the algorithm is wrong.
It may be because your
_utcStart
is converted to local time when it is initialized, instead of converting the calculated target time to local time. Daylight saving time changes will not be reflected in the UTC timestamp 0.
Should I change the code to:
DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString(...)
DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString(...)
I am not familiar with time handling in C#, but it looks similar to what I usually do in Java (as shown below)
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(timestamp))
DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString(...)
I am not familiar with time handling in C#, but it looks similar to what I usually do in Java (as shown below)
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(timestamp))
Thanks for reply. I'll try to fix it by this way.
thanks! checked and works fine here now! 👏🏻
I'm using with my custom server (i'm on CEST as timezone) and this is a gk list:
and this is a sourcegit list: