Skip to content

Commit 52a8231

Browse files
committed
fix unix time
1 parent 8efc098 commit 52a8231

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Qiniu/RS/GetPolicy.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ public static string MakeRequest (string baseUrl, UInt32 expires = 3600, Mac mac
1515
if (mac == null) {
1616
mac = new Mac (Config.ACCESS_KEY, Config.Encoding.GetBytes (Config.SECRET_KEY));
1717
}
18-
DateTime begin = new DateTime (1970, 1, 1);
19-
DateTime now = DateTime.Now;
20-
TimeSpan interval = new TimeSpan (now.Ticks - begin.Ticks);
21-
UInt32 deadline = (UInt32)interval.TotalSeconds + expires;
18+
19+
UInt32 deadline = (UInt32)((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 + expires);
2220
if (baseUrl.Contains ('?')) {
2321
baseUrl += "&e=";
2422
} else {

0 commit comments

Comments
 (0)