tz

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tz is the server's time zone. It starts as the machine's (or the TZ environment variable's), and an admin can pick another in Settings, which is what the logs, holiday rows and anything else that goes by the server's clock use from the server's next start. It can't change while the server runs: Go's local time zone is read without a lock everywhere.

Index

Constants

View Source
const Setting = "time_zone"

Setting is the IANA name of the time zone the admin picked, such as America/Juneau; empty means the machine's own.

Variables

This section is empty.

Functions

func InUse

func InUse() string

InUse is the name of the time zone the server runs in: the admin's pick as of its start, or the machine's (System), or "" when that isn't known.

func Load

func Load(ctx context.Context, db Store) error

Load switches the server to the time zone the admin picked. Call it once at startup, before anything else runs.

func System

func System() string

System is the name of the machine's own time zone when it's known (from TZ), or "".

func Valid

func Valid(name string) bool

Valid says whether name is a time zone this server knows; "" stands for the machine's own and is valid too.

Types

type Store

type Store interface {
	Setting(ctx context.Context, key string) (string, error)
}

Store reads settings, as store.Store does.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL