Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #29 from nabeshin/fix_stash_datetime

Fixed DateTime property of Stash class.
  • Loading branch information...
commit 4cef5fe76e80cfb457abb7d5f9d8c5040affa4c5 2 parents b72fbd2 + 9bb1e46
@henon authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 GitSharp/Stash.cs
View
11 GitSharp/Stash.cs
@@ -108,9 +108,14 @@ internal static Stash Parse (string line)
i2 += 2;
i = line.IndexOf (' ', i2);
int secs = int.Parse (line.Substring (i2, i - i2));
- DateTime t = new DateTime (1970, 1, 1) + TimeSpan.FromSeconds (secs);
- string st = t.ToString ("yyyy-MM-ddTHH:mm:ss") + line.Substring (i + 1, 3) + ":" + line.Substring (i + 4, 2);
- s.DateTime = DateTimeOffset.Parse (st);
+
+ string stUtcOffset = line.Substring (i + 1, 3) + ":" + line.Substring (i + 4, 2);
+ if (stUtcOffset[0] == '+') stUtcOffset = stUtcOffset.Remove(0, 1);
+ TimeSpan utcOffset = TimeSpan.Parse(stUtcOffset);
+
+ DateTime t = new DateTime (1970, 1, 1) + TimeSpan.FromSeconds (secs) + utcOffset;
+ s.DateTime = new DateTimeOffset(t, utcOffset);
+
s.Comment = line.Substring (i + 7);
}
s.FullLine = line;
Please sign in to comment.
Something went wrong with that request. Please try again.