All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iosArm64Main.common.TimeZone.objc.kt Maven / Gradle / Ivy

The newest version!
package com.github.fluidsonic.fluid.time

import platform.Foundation.*


fun TimeZone.toPlatform() =
	platform


actual typealias PlatformTimeZone = NSTimeZone


internal actual fun PlatformTimeZone.daylightSavingTimeOffset(timestamp: Timestamp) =
	Seconds(daylightSavingTimeOffsetForDate(timestamp.toPlatform()).toLong())


internal actual val PlatformTimeZone.id: String
	get() =
		name.let { id ->
			if (id == "GMT") "UTC" else id
		}


internal actual fun PlatformTimeZone.isDaylightSavingTime(timestamp: Timestamp) =
	isDaylightSavingTimeForDate(timestamp.toPlatform())


internal actual fun PlatformTimeZone.nextDaylightSavingTimeTransition(after: Timestamp) =
	nextDaylightSavingTimeTransitionAfterDate(after.toPlatform())?.toCommon()


internal actual object PlatformTimeZoneStatic {

	@Suppress("UNCHECKED_CAST")
	actual val knownTimeZoneIds: Set =
		(PlatformTimeZone.knownTimeZoneNames as List).toSet()


	actual val systemTimeZoneId: String
		get() = PlatformTimeZone.systemTimeZone.id


	actual fun timeZoneWithId(id: String) =
		PlatformTimeZone.timeZoneWithName(id)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy