DateTime (SerializationInfo info, StreamingContext context)
{
if (info.HasKey ("dateData")){
- encoded = info.GetInt64 ("dateData");
+ encoded = (Int64)info.GetUInt64 ("dateData");
} else if (info.HasKey ("ticks")){
encoded = info.GetInt64 ("ticks") & TicksMask;
} else {
long now = GetNow ();
DateTime dt = new DateTime (now);
- if ((now - last_now) > TimeSpan.TicksPerMinute){
+ if (Math.Abs (now - last_now) > TimeSpan.TicksPerMinute){
to_local_time_span_object = TimeZone.CurrentTimeZone.GetLocalTimeDiff (dt);
last_now = now;
if (maxlength <= 0)
maxlength = value.Length;
- if (sPos + maxlength <= s.Length && String.Compare (s, sPos, value, 0, maxlength, true, CultureInfo.InvariantCulture) == 0) {
+ if (sPos + maxlength <= s.Length && String.CompareOrdinalCaseInsensitive (s, sPos, value, 0, maxlength) == 0) {
num_parsed = maxlength;
return true;
}
// '.FFF....' can be mapped to nothing
if (pos + 1 < len && chars[pos + 1] == 'F') {
++pos;
- while (pos < len && chars[pos + 1] == 'F') {
+ while (pos + 1 < len && chars[pos + 1] == 'F') {
++pos;
}
{
if ((style & DateTimeStyles.AdjustToUniversal) != 0 || (style & DateTimeStyles.AssumeLocal) != 0 ||
(style & DateTimeStyles.AssumeUniversal) != 0)
- throw new ArgumentException ("The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, Asersal or AdjustToUniversal.", "style");
+ throw new ArgumentException ("The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.", "style");
}
if ((style & DateTimeStyles.AssumeUniversal) != 0 && (style & DateTimeStyles.AssumeLocal) != 0)
throw new ArgumentException ("The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.", "style");
if (format == null || format == String.Empty)
format = "G";
- bool useutc = false, use_invariant = false;
-
if (format.Length == 1) {
char fchar = format [0];
+ bool use_invariant, useutc;
format = DateTimeUtils.GetStandardPattern (fchar, dfi, out useutc, out use_invariant);
if (fchar == 'U')
return DateTimeUtils.ToString (ToUniversalTime (), format, dfi);
if (format == null)
throw new FormatException ("format is not one of the format specifier characters defined for DateTimeFormatInfo");
+
+ if (use_invariant)
+ dfi = DateTimeFormatInfo.InvariantInfo;
}
// Don't convert UTC value. It just adds 'Z' for
info.AddValue ("ticks", t);
// This is the new .NET format, encodes the kind on the top bits
- info.AddValue ("dateData", encoded);
+ info.AddValue ("dateData", (UInt64)encoded);
}
#if MONOTOUCH