mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 01:10:08 +00:00
增加GanttChart甘特图
This commit is contained in:
33
Runtime/Utils/DateTimeUtil.cs
Normal file
33
Runtime/Utils/DateTimeUtil.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/************************************************/
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public static class DateTimeUtil
|
||||
{
|
||||
private static readonly DateTime k_DateTime1970 = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
|
||||
public static int GetTimestamp()
|
||||
{
|
||||
return (int)(DateTime.Now - k_DateTime1970).TotalSeconds;
|
||||
}
|
||||
|
||||
public static int GetTimestamp(DateTime time)
|
||||
{
|
||||
return (int)(time - k_DateTime1970).TotalSeconds;
|
||||
}
|
||||
|
||||
public static DateTime GetDateTime(int timestamp)
|
||||
{
|
||||
long span = ((long)timestamp) * 10000000;
|
||||
return k_DateTime1970.Add(new TimeSpan(span));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Utils/DateTimeUtil.cs.meta
Normal file
11
Runtime/Utils/DateTimeUtil.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f0ac80f189a04b5c826f40c8bc8af64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user