备份CatanBuilding瘦身独立工程
This commit is contained in:
23
Assets/Scripts/DataCenter/DateTimeExtensions.cs
Normal file
23
Assets/Scripts/DataCenter/DateTimeExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class DateTimeExtensions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///游戏本地零点时间 相对于UTC时间的偏移 offset 个小时,计算每周几、每日几时(跨天=每日0时)这种到期时间
|
||||
///或者统一计算需求 调用此方法
|
||||
///自己记录时间段 比如从当前时间往后推一段时间不需要 调用此方法
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime UtcNowOffset(this DateTime dateTime)
|
||||
{
|
||||
var offset = GContext.container.Resolve<Tables>().TbGlobalConfig.GlobalTimeOffset;
|
||||
return dateTime.AddHours(-offset);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user