Table of Contents

Class XTimeSpan

Additional members to supplement the TimeSpan class.

Mostly constants. For consistency with TimeSpan, I've used long as the type for any integer constants. For non-integer constants I've used double.

The following constants are already provided by the TimeSpan class and not reproduced here:

  • TicksPerMicrosecond
  • TicksPerMillisecond
  • TicksPerSecond
  • TicksPerMinute
  • TicksPerHour
  • TicksPerDay

NOTE: Any constants or methods for converting between time units will become obsolete with the completion of Galaxon.Quantities.

The word Month, Year, Decade, Century, or Millennium in a constant name usually refers to the average length of that time unit in the Gregorian Calendar.

Inheritance
System.Object
XTimeSpan
Namespace: Galaxon.Core.Time
Assembly: Galaxon.Core.dll
Syntax
public static class XTimeSpan : object

Fields

CommonYearsPerSolarCycle

The number of common years in a Gregorian solar cycle.

Declaration
public const long CommonYearsPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

DaysPerCentury

The average number of days in a Gregorian century.

Declaration
public const double DaysPerCentury = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerDecade

The average number of days in a Gregorian decade.

Declaration
public const double DaysPerDecade = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerJulianCentury

The number of days in a Julian Calendar century.

Declaration
public const long DaysPerJulianCentury = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

DaysPerJulianDecade

The number of days in a Julian Calendar decade.

Declaration
public const double DaysPerJulianDecade = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerJulianMillennium

The number of days in a Julian Calendar millennium.

Declaration
public const long DaysPerJulianMillennium = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

DaysPerJulianYear

The number of days in a Julian Calendar year.

Declaration
public const double DaysPerJulianYear = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerLunation

Number of days in a synodic lunar month (a.k.a. "lunation").

Declaration
public const double DaysPerLunation = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerMillennium

The average number of days in a Gregorian millennium.

Declaration
public const double DaysPerMillennium = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerMonth

The average number of days in a Gregorian month.

Declaration
public const double DaysPerMonth = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerSolarCycle

The number of days in a Gregorian solar cycle.

Declaration
public const long DaysPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

DaysPerTropicalYear

The number of days in the mean tropical year B1900 (days). This value is taken from the SOFA (Standards of Fundamental Astronomy) library, which is assumed to be authoritative.

Declaration
public const double DaysPerTropicalYear = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

DaysPerWeek

The number of days in a week.

Declaration
public const long DaysPerWeek = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

DaysPerYear

The average number of days in a Gregorian year.

Declaration
public const double DaysPerYear = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

HoursPerDay

The number of hours in an ephemeris day.

Declaration
public const long HoursPerDay = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

HoursPerWeek

The number of hours in a week.

Declaration
public const long HoursPerWeek = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

LeapYearsPerSolarCycle

The number of leap years in a Gregorian solar cycle.

Declaration
public const long LeapYearsPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

MinutesPerDay

The number of minutes in a day.

Declaration
public const long MinutesPerDay = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

MinutesPerHour

The number of minutes in an hour.

Declaration
public const long MinutesPerHour = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

MonthsPerSolarCycle

The number of months in a Gregorian solar cycle.

Declaration
public const long MonthsPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

MonthsPerYear

The number of months in a Gregorian year.

Declaration
public const long MonthsPerYear = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

OlympiadsPerSolarCycle

Number of olympiads in an Gregorian solar cycle.

Declaration
public const long OlympiadsPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerCentury

The average number of seconds in a Gregorian century.

Declaration
public const long SecondsPerCentury = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerDay

The number of seconds in an ephemeris day.

Declaration
public const long SecondsPerDay = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerDecade

The average number of seconds in a Gregorian decade.

Declaration
public const long SecondsPerDecade = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerHour

The number of seconds in an hour.

Declaration
public const long SecondsPerHour = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerMicrosecond

The number of seconds in a microsecond.

Declaration
public const double SecondsPerMicrosecond = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

SecondsPerMillennium

The average number of seconds in a Gregorian millennium.

Declaration
public const long SecondsPerMillennium = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerMillisecond

The number of seconds in a millisecond.

Declaration
public const double SecondsPerMillisecond = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

SecondsPerMinute

The number of seconds in a minute.

Declaration
public const long SecondsPerMinute = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerMonth

The average number of seconds in a month.

Declaration
public const long SecondsPerMonth = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerSolarDay

The number of seconds in a solar day (as at 2023). It is increasing by about 2 milliseconds per century.

Declaration
public const double SecondsPerSolarDay = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

SecondsPerTick

The number of seconds in a nanosecond.

Declaration
public const double SecondsPerTick = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

SecondsPerWeek

The number of seconds in a week.

Declaration
public const long SecondsPerWeek = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

SecondsPerYear

The average number of seconds in a Gregorian year.

Declaration
public const long SecondsPerYear = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

TicksPerCentury

The number of ticks in a Gregorian century.

Declaration
public const long TicksPerCentury = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

TicksPerDecade

The number of ticks in a Gregorian decade.

Declaration
public const long TicksPerDecade = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

TicksPerMillennium

The number of ticks in a Gregorian millennium.

Declaration
public const long TicksPerMillennium = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

TicksPerMonth

The number of ticks in a month.

Declaration
public const long TicksPerMonth = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

TicksPerNanosecond

The number of ticks in a nanosecond.

Declaration
public const double TicksPerNanosecond = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

TicksPerWeek

The number of ticks in a week.

Declaration
public const long TicksPerWeek = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

TicksPerYear

The number of ticks in a Gregorian year.

Declaration
public const long TicksPerYear = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

WeeksPerMonth

The number of weeks in an average Gregorian month.

Declaration
public const double WeeksPerMonth = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

WeeksPerSolarCycle

The number of weeks in a Gregorian solar cycle.

Declaration
public const long WeeksPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

WeeksPerYear

The number of weeks in a Gregorian year.

Declaration
public const double WeeksPerYear = null
Field Value
Type Description
System.Double
| Improve this Doc View Source

YearsPerCentury

The number of years in a century.

Declaration
public const long YearsPerCentury = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

YearsPerDecade

The number of years in a decade.

The precise length of a decade depends on what year is being used. For a example, a Gregorian decade (3652.425 d on average) will have a different length to an Islamic Calendar decade (about 3543.67 d on average) or a tropical decade (3652.42198781 d on average).

Declaration
public const long YearsPerDecade = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

YearsPerMillennium

The number of years in a millennium.

Declaration
public const long YearsPerMillennium = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

YearsPerOlympiad

Number of years in an olympiad.

Declaration
public const long YearsPerOlympiad = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

YearsPerSolarCycle

The Gregorian Calendars repeats on a 400-year cycle called the solar cycle.

There are 97 leap years in that period, giving an average calendar year length of 365 + (97/400) = 365.2425 days/year.

1 Gregorian solar cycle = 400 y = 4800 mon = 20,871 w = 146,097 d

5 Gregorian solar cycles = 2000 y = 2 ky

Solar cycles are not ordinarily numbered, nor given a specific start date. However, within the proleptic Gregorian epoch (the one used by .NET), which began on Monday, 1 Jan, 1 AD, we are currently in the 6th solar cycle. It began on Monday, 1 Jan, 2001, which was also the first day of the 3rd millennium AD. It will end on Sunday, 31 Dec, 2400.

See:

  • https://en.wikipedia.org/wiki/Solar_cycle_(calendar)
  • https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
Declaration
public const long YearsPerSolarCycle = null
Field Value
Type Description
System.Int64
| Improve this Doc View Source

Methods

Convert(Double, ETimeUnit, ETimeUnit)

Convert a time value from one unit to another. TODO Replace with Quantity methods.

Declaration
public static double Convert(double amount, ETimeUnit fromUnit, ETimeUnit toUnit = ETimeUnit.Tick)
Parameters
Type Name Description
System.Double amount

The amount.

ETimeUnit fromUnit

The amount argument units.

ETimeUnit toUnit

The result units.

Returns
Type Description
System.Double

The amount of the new unit.

| Improve this Doc View Source
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX | Galaxy logo by Freepik