mirror of
https://github.com/cxfksword/jellyfin-plugin-danmu.git
synced 2026-02-02 17:59:58 +08:00
Fix timezone #19
This commit is contained in:
@@ -8,10 +8,12 @@ namespace Jellyfin.Plugin.Danmu.Core
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
private static TimeZoneInfo beijingTimeZone = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
|
||||
// 北京时区
|
||||
static TimeZoneInfo beijingTimeZone = TimeZoneInfo.CreateCustomTimeZone("GMT+8", TimeSpan.FromHours(8), null, null);
|
||||
|
||||
public static DateTime UnixTimeStampToDateTime(long unixTimeStamp)
|
||||
{
|
||||
// 转成北京时间,bilibili接口的年份只要是根据北京时间返回
|
||||
// Unix timestamp is seconds past epoch
|
||||
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
dateTime = TimeZoneInfo.ConvertTime(dateTime.AddSeconds(unixTimeStamp), TimeZoneInfo.Utc, beijingTimeZone);
|
||||
|
||||
Reference in New Issue
Block a user