Skip to content

Commit eaf487c

Browse files
committed
Merge pull request #35 from icattlecoder/hotfix/unixtime
fix universalTime
2 parents 2961568 + a982882 commit eaf487c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Qiniu/RS/PutPolicy.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ public UInt64 Expires {
9696
public PutPolicy (string scope, UInt32 expires=3600)
9797
{
9898
Scope = scope;
99-
DateTime begin = new DateTime (1970, 1, 1);
100-
DateTime now = DateTime.Now;
101-
TimeSpan interval = new TimeSpan (now.Ticks - begin.Ticks);
102-
Expires = (UInt32)interval.TotalSeconds + expires;
99+
UInt32 deadline = (UInt32)((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 + expires);
100+
Expires = deadline;
103101
}
104102

105103
/// <summary>

Qiniu/RS/RSClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public enum FileHandle
3838
/// </summary>
3939
public class RSClient :QiniuAuthClient
4040
{
41-
private static string[] OPS = new string[] { "stat", "move", "copy", "delet" };
41+
private static string[] OPS = new string[] { "stat", "move", "copy", "delete" };
4242

4343
public RSClient (Mac mac=null)
4444
: base(mac)

0 commit comments

Comments
 (0)