File tree 3 files changed +10
-5
lines changed
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ import kotlinx.cinterop.*
10
10
import kotlinx.datetime.internal.*
11
11
import platform.Foundation.*
12
12
13
- internal actual val systemTzdb: TimeZoneDatabase = TzdbOnFilesystem (Path .fromString(defaultTzdbPath()))
13
+ internal actual val systemTzdb: TimeZoneDatabase get() = tzdb.getOrThrow()
14
+
15
+ private val tzdb = runCatching { TzdbOnFilesystem (Path .fromString(defaultTzdbPath())) }
14
16
15
17
internal expect fun defaultTzdbPath (): String
16
18
Original file line number Diff line number Diff line change 5
5
6
6
package kotlinx.datetime.internal
7
7
8
- internal actual val systemTzdb: TimeZoneDatabase = TzdbOnFilesystem ()
8
+ internal actual val systemTzdb: TimeZoneDatabase get() = tzdb.getOrThrow()
9
+
10
+ private val tzdb = runCatching { TzdbOnFilesystem () }
9
11
10
12
internal actual fun currentSystemDefaultZone (): Pair <String , TimeZoneRules ?> {
11
13
val zoneId = pathToSystemDefault()?.second?.toString()
Original file line number Diff line number Diff line change 5
5
6
6
package kotlinx.datetime.internal
7
7
8
- internal actual val systemTzdb: TimeZoneDatabase get() = tzdbInRegistry
8
+ internal actual val systemTzdb: TimeZoneDatabase get() = tzdbInRegistry.getOrThrow()
9
9
10
- internal actual fun currentSystemDefaultZone (): Pair <String , TimeZoneRules ?> = tzdbInRegistry.currentSystemDefault()
10
+ internal actual fun currentSystemDefaultZone (): Pair <String , TimeZoneRules ?> =
11
+ tzdbInRegistry.getOrThrow().currentSystemDefault()
11
12
12
- private val tzdbInRegistry = TzdbInRegistry ()
13
+ private val tzdbInRegistry = runCatching { TzdbInRegistry () }
You can’t perform that action at this time.
0 commit comments