CosmosTime.ZoneTime - osexpert/CosmosTime GitHub Wiki
Store utc + offset + tz
If storing a clock time in the future and the tz-database changes, the clock time may be wrong since we calculate clock time from utc.
tz-database changes: updated regularly, so for utc time in the future, we can't know for sure what the offset will be in a zone.
I guess if we wanted a struct with focus on clock times, and where the utc\global time would change in the future, if tz-db changes,
then would need eg. ClockZoneTime (clock_time + offset + tz)
public struct ZoneTime :
System.IEquatable<CosmosTime.ZoneTime>,
System.IComparable<CosmosTime.ZoneTime>,
System.IComparableImplements System.IEquatable<ZoneTime>, System.IComparable<ZoneTime>, System.IComparable
| Constructors | |
|---|---|
| ZoneTime(ClockTime, TimeZoneInfo) | Uses default offset (standard time offset) in case of ambigous time. |
| ZoneTime(ClockTime, TimeZoneInfo, TimeSpan) | Can specift offset here to choose correct offset in case of ambigous time. TODO: could have had a callback...so only need to specify offset if ambigous? |
| ZoneTime(OffsetTime, TimeZoneInfo) | TODO |
| ZoneTime(UtcTime, TimeZoneInfo) | TODO |
| ZoneTime(int, int, int, int, int, int, int, TimeZoneInfo) | year, month, day, etc. in Zone time |
| ZoneTime(int, int, int, int, int, int, int, TimeZoneInfo, TimeSpan) | year, month, day, etc. in Zone time Both tz and offset? Yes, in case you want to choose offset if ambigous time (or you simply know it up front) |
| ZoneTime(int, int, int, int, int, int, TimeZoneInfo) | year, month, day, etc. in Zone time |
| ZoneTime(int, int, int, int, int, int, TimeZoneInfo, TimeSpan) | year, month, day, etc. in Clock time Both tz and offset? Yes, in case you want to choose offset if ambigous time (or you simply know it up front) |
| ZoneTime(int, int, int, TimeZoneInfo) | year, month, day, etc. in Zone time |
| ZoneTime(int, int, int, TimeZoneInfo, TimeSpan) | year, month, day, etc. in Zone time Both tz and offset? Yes, in case you want to choose offset if ambigous time (or you simply know it up front) |
| Properties | |
|---|---|
| Date | Date in Clock time |
| LocalNow | Will capture Utc time + local offset to utc It make little sense to call this on a server, it will capture the server offset to utc, and that make little sense. Same as Now(TimeZoneInfo.Local) |
| OffsetTime | TODO |
| Ticks | Ticks in Clock time |
| TimeOfDay | TimeOfDay in Clock time |
| UtcNow | An UtcOffsetTime with utc time without offset (no time zone info) Same as Now(TimeZoneInfo.Utc) |
| Zone | TODO |
| Methods | |
|---|---|
| AddClock(TimeSpan) | TODO |
| AddClockDays(double) | TODO |
| AddClockHours(double) | TODO |
| AddClockMinutes(double) | TODO |
| AddClockSeconds(double) | TODO |
| AddClockTicks(long) | TODO |
| AddUtc(TimeSpan) | TODO |
| AddUtcHours(double) | TODO |
| AddUtcMinutes(double) | TODO |
| AddUtcSeconds(double) | TODO |
| AddUtcTicks(long) | TODO |
| CompareTo(ZoneTime) | TODO |
| Equals(ZoneTime) | Equal if the Utc time is equal. The offset is ignored, it is only used to make local times. The tz is ignored, Utc is valid on its own |
| Equals(object) | TODO |
| EqualsExact(ZoneTime) | Also check that offset and zone is the same |
| FromLocalDateTime(DateTime) | TODO |
| FromUnspecifiedDateTime(DateTime, TimeZoneInfo) | TODO |
| FromUtcDateTime(DateTime) | DateTime must be Kind.Utc, else will throw TODO: why not allow Local?? Does now. |
| GetHashCode() | TODO |
| Now(TimeZoneInfo) | Get Now in a zone (time will always be utc, but the offset captured will depend on the tz, and if ambigous, one will be chosen for you (standard time)) |
| ParseCosmosDb(string, TimeSpan, string) | Parse fixed length utc time |
| SubtractClock(ZoneTime) | TODO |
| SubtractClock(TimeSpan) | TODO |
| SubtractUtc(ZoneTime) | TODO |
| SubtractUtc(TimeSpan) | TODO |
| ToString() | Iso format: {time}+ |
| TryParse(string, ZoneTime, Func<TimeSpan[],TimeSpan>) | Supported directly: {time}Z[{tz}] -> {time}-00:00 {time}+ |
| Operators | |
|---|---|
| operator ==(ZoneTime, ZoneTime) | Equality and ordering is always in Utc TODO |
| operator >(ZoneTime, ZoneTime) | TODO |
| operator >=(ZoneTime, ZoneTime) | TODO |
| operator !=(ZoneTime, ZoneTime) | TODO |
| operator <(ZoneTime, ZoneTime) | TODO |
| operator <=(ZoneTime, ZoneTime) | TODO |