kotest-extensions / io.kotest.extensions.locale / withDefaultTimeZone

withDefaultTimeZone

inline fun <reified T> withDefaultTimeZone(timeZone: TimeZone, block: () -> T): T

Replaces the default TimeZone

This function replaces the current default timeZone with timeZone, then executes block and finally returns the original default timeZone to it's place.

Attention: This code is subject to race conditions. The System can only have one default timeZone, and if you change the timeZone while it was already changed, the result may be inconsistent.