public static int TimestampToURI(char[] buf, int pos, DateTime value) { if (value.Kind == DateTimeKind.Utc) { value = value.ToLocalTime(); } var offset = CurrentZone.GetUtcOffset(value); if (offset.Minutes != 0) { return(TimestampConverter.Serialize(value.AddMinutes(offset.Minutes), buf, pos, offset.Hours)); } return(TimestampConverter.Serialize(value, buf, pos, offset.Hours)); }
public static int NullableTimestampToURI(char[] buf, int pos, DateTime?value) { if (value == null) { return(pos); } var v = value.Value; if (v.Kind == DateTimeKind.Utc) { v = v.ToLocalTime(); } var offset = CurrentZone.GetUtcOffset(v); if (offset.Minutes != 0) { return(TimestampConverter.Serialize(v.AddMinutes(offset.Minutes), buf, pos, offset.Hours)); } return(TimestampConverter.Serialize(v, buf, pos, offset.Hours)); }