time_machine library

Classes

AnnualDate
Represents an annual date (month and day) in the ISO calendar but without a specific year, typically for recurrent events such as birthdays, anniversaries, and deadlines. [...]
CalendarSystem
A calendar system maps the non-calendar-specific "local time line" to human concepts such as years, months and days. [...]
Clock
IClock is intended for use anywhere you need to have access to the current time. Although it's not strictly incorrect to call SystemClock.Instance.GetCurrentInstant() directly, in the same way as you might call DateTime.UtcNow, it's strongly discouraged as a matter of style for production code. We recommend providing an instance of IClock to anything that needs it, which allows you to write tests using the fake clock in the TimeMachine.Testing assembly (or your own implementation). [...]
Culture
Cultures
DateAdjusters
Factory class for date adjusters: functions from LocalDate to LocalDate, which can be applied to LocalDate, LocalDateTime, and OffsetDateTime.
DateInterval
An interval between two dates. [...]
DateTimeFormat
DateTimeFormatBuilder
DateTimeZone
Represents a time zone - a mapping between UTC and local time. A time zone maps UTC instants to local times [...]
DateTimeZoneCache
Provides an implementation of DateTimeZoneProvider that caches results from an DateTimeZoneSource. [...]
DateTimeZoneProvider
Provides stable, performant time zone data. [...]
DateTimeZoneProviders
DateTimeZoneSource
Provides the interface for objects that can retrieve time zone definitions given an ID. [...]
DayOfWeek
Equates the days of the week with their numerical value according to ISO-8601.
Era
Represents an era used in a calendar. [...]
Instant
Represents an instant on the global timeline, with nanosecond resolution. [...]
Interval
An interval between two instants in time (start and end). [...]
LocalDate
LocalDateTime
A date and time in a particular calendar system. A LocalDateTime value does not represent an instant on the global time line, because it has no associated time zone: "November 12th 2009 7pm, ISO calendar" occurred at different instants for different people around the world. [...]
LocalTime
LocalTime is an immutable class representing a time of day, with no reference to a particular calendar, time zone or date.
Offset
An offset from UTC in seconds. A positive value means that the local time is ahead of UTC (e.g. for Europe); a negative value means that the local time is behind UTC (e.g. for America). [...]
OffsetDate
A combination of a LocalDate and an Offset, to represent a date at a specific offset from UTC but without any time-of-day information. [...]
OffsetDateTime
A local date and time in a particular calendar system, combined with an offset from UTC. [...]
OffsetTime
Period
Represents a period of time expressed in human chronological terms: hours, days, weeks, months and so on. [...]
PeriodBuilder
A mutable builder class for Period values. Each property can be set independently, and then a Period can be created from the result using the build method.
PeriodUnits
The units within a period. When a period is created to find the difference between two local values, the caller may specify which units are required - for example, you can ask for the difference between two dates in "years and weeks". Units are always applied largest-first in arithmetic.
Resolvers
Commonly-used implementations of the delegates used in resolving a LocalDateTime to a ZonedDateTime, and a method to combine two "partial" resolvers into a full one. [...]
SystemClock
Singleton implementation of Clock which reads the current system time. It is recommended that for anything other than throwaway code, this is only referenced in a single place in your code: where you provide a value to inject into the rest of your application, which should only depend on the interface.
Time
Represents a fixed (and calendar-independent) length of time. [...]
TimeAdjusters
Factory class for time adjusters: functions from LocalTime to LocalTime, which can be applied to LocalTime, LocalDateTime, and OffsetDateTime.
TimeConstants
Useful constants, mostly along the lines of "number of milliseconds in an hour". Useful constants, mostly along the lines of "number of milliseconds in an hour".
TimeMachine
TzdbDateTimeZoneSource
WeekYearRule
A rule determining how "week years" are arranged, including the weeks within the week year. Implementations provided by Time Machine itself can be obtained via the WeekYearRules class. [...]
WeekYearRules
Factory methods to construct week-year rules supported by Time Machine.
ZonedClock
A clock with an associated time zone and calendar. This is effectively a convenience class decorating an Clock.
ZonedDateTime
A LocalDateTime in a specific time zone and with a particular offset to distinguish between otherwise-ambiguous instants. A ZonedDateTime is global, in that it maps to a single Instant. [...]
ZoneEqualityComparer
Equality comparer for time zones, comparing specific aspects of the zone intervals within a time zone for a specific interval of the time line. [...]
ZoneEqualityComparerOptions
Options to use when comparing time zones for equality. Each option makes the comparison more restrictive. [...]
ZoneInterval
Represents a range of time for which a particular Offset applies.
ZoneLocalMapping
The result of mapping a LocalDateTime within a time zone, i.e. finding out at what "global" time the "local" time occurred. [...]

Enums

CalendarType
CalendarWeekRule
HebrewMonthNumbering
The month numbering to use for the Hebrew calendar. [...]
IslamicEpoch
The epoch to use when constructing an Islamic calendar. [...]
IslamicLeapYearPattern
The pattern of leap years to use when constructing an Islamic calendar. [...]

Typedefs

AmbiguousTimeResolver(ZonedDateTime earlier, ZonedDateTime later) ZonedDateTime
Chooses between two ZonedDateTime values that resolve to the same LocalDateTime. [...]
SkippedTimeResolver(LocalDateTime localDateTime, DateTimeZone zone, ZoneInterval intervalBefore, ZoneInterval intervalAfter) ZonedDateTime
Resolves a LocalDateTime to a ZonedDateTime in the situation where the requested local time does not exist in the target time zone. [...]
ZoneLocalMappingResolver(ZoneLocalMapping mapping) ZonedDateTime
Resolves the result of attempting to map a local date and time to a target time zone. [...]

Exceptions / Errors

AmbiguousTimeError
DateTimeZoneNotFoundError
Exception thrown when time zone is requested from an IDateTimeZoneProvider, but the specified ID is invalid for that provider.
InvalidDateTimeZoneSourceError
Exception thrown to indicate that a time zone source has violated the contract of IDateTimeZoneSource. This exception is primarily intended to be thrown from DateTimeZoneCache, and only in the face of a buggy source; user code should not usually need to be aware of this or catch it.
InvalidTimeDataError
Exception thrown when data read by Time Machine (such as serialized time zone data) is invalid. This includes data which is truncated, i.e. we expect more data than we can read.
SkippedTimeError
Exception thrown to indicate that the specified local time doesn't exist in a particular time zone due to daylight saving time changes. [...]