Skip to main content

set_system_timezone

Function set_system_timezone 

Source
pub fn set_system_timezone(tz: Tz) -> Result<(), Error>
Expand description

Sets the system timezone on Kobo devices.

§Kobo

This function performs three operations to ensure the timezone change is persistent and immediately reflected in the running process:

  1. Creates /etc/localtime as a symlink to the appropriate zoneinfo file (recognized by system utilities and the C library).
  2. Writes the timezone name to /etc/timezone for persistence across reboots.
  3. Updates the current process’s timezone state by setting the TZ environment variable and calling libc::tzset(). This ensures that subsequent calls to libc time functions in this process reflect the new timezone immediately, rather than the system-wide timezone being adopted only after the process restarts.

§Errors

Returns an error if any filesystem operations fail.