static class · System

LocalZone

static class LocalZone

The local time zone's offset from UTC, asked of the system once per quarter hour of UTC (zones change their offset only on quarter hours).

Kind
static class
Namespace
System
Assembly
System.Core
Access
internal, static, abstract
Source file
Time.ant

Inheritance

Base classes
Any LocalZone

Methods

Offset(i64 utcTicks) : i64
#

static

The offset in ticks at a UTC moment (ticks since 0001).

OffsetOfLocal(i64 localTicks) : i64
#

static

The offset in ticks at a local moment: the offset at the moment it would be in UTC, checked once more (near a change the two can differ).

Private and internal members (3)

i64 quarter = -9223372036854775808
#

private static

i64 cached
#

private static

extern("time.offset") OffsetAt(i64 seconds) : i64
#

private static

Inherited members (5)

Source

LocalZone as Antril, decompiled from its Larva HIR.

System.LocalZone.ant
// System.LocalZone — System.Core (decompiled from Larva HIR)

into namespace System
{
	/// The local time zone's offset from UTC, asked of the system once per quarter hour of UTC (zones change their offset
	/// only on quarter hours).
	static class LocalZone
	{
		i64 quarter = -9223372036854775808;
		i64 cached;

		extern("time.offset") OffsetAt(i64 seconds) : i64;

		public:
			/// The offset in ticks at a UTC moment (ticks since 0001).
			Offset(i64 utcTicks) : i64
			{
				i64 seconds = utcTicks / 10000000 - 62135596800;
				i64 at = seconds >= 0 ? seconds / 900 : (seconds - 899) / 900;
				if (at != quarter)
				{
					cached = OffsetAt(seconds) * 10000000;
					quarter = at;
				}
				return cached;
			}

			/// The offset in ticks at a local moment: the offset at the moment it would be in UTC, checked once more
			/// (near a change the two can differ).
			OffsetOfLocal(i64 localTicks) : i64
			{
				i64 first = Offset(localTicks);
				i64 second = Offset(localTicks - first);
				return second;
			}
	}
}
Esc