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).

Tipo
static class
Espacio de nombres
System
Ensamblado
System.Core
Acceso
internal, static, abstract
Archivo fuente
Time.ant

Herencia

Clases base
Any LocalZone

Métodos

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).

Miembros privados e internos (3)

i64 quarter = -9223372036854775808
#

private static

i64 cached
#

private static

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

private static

Miembros heredados (5)

Código fuente

LocalZone en Antril, descompilado a partir de su 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