From a982882f28a9c51b1201f590b408c5d8b25628c5 Mon Sep 17 00:00:00 2001 From: icattlecoder Date: Wed, 23 Oct 2013 16:33:48 +0800 Subject: [PATCH] fix universalTime --- Qiniu/RS/PutPolicy.cs | 6 ++---- Qiniu/RS/RSClient.cs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Qiniu/RS/PutPolicy.cs b/Qiniu/RS/PutPolicy.cs index 5d5f17b3..d3f700e3 100644 --- a/Qiniu/RS/PutPolicy.cs +++ b/Qiniu/RS/PutPolicy.cs @@ -96,10 +96,8 @@ public UInt64 Expires { public PutPolicy (string scope, UInt32 expires=3600) { Scope = scope; - DateTime begin = new DateTime (1970, 1, 1); - DateTime now = DateTime.Now; - TimeSpan interval = new TimeSpan (now.Ticks - begin.Ticks); - Expires = (UInt32)interval.TotalSeconds + expires; + UInt32 deadline = (UInt32)((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 + expires); + Expires = deadline; } /// diff --git a/Qiniu/RS/RSClient.cs b/Qiniu/RS/RSClient.cs index ac5c9a98..6054aa5c 100644 --- a/Qiniu/RS/RSClient.cs +++ b/Qiniu/RS/RSClient.cs @@ -38,7 +38,7 @@ public enum FileHandle /// public class RSClient :QiniuAuthClient { - private static string[] OPS = new string[] { "stat", "move", "copy", "delet" }; + private static string[] OPS = new string[] { "stat", "move", "copy", "delete" }; public RSClient (Mac mac=null) : base(mac)