clock

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

internal/clock/clock.go

Package clock declares gitback's two timestamp formats, so neither is ever hardcoded or re-decided ad hoc at a call site.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilenameUTC

func FilenameUTC(t time.Time) string

FilenameUTC formats t using filenameLayout, always in UTC regardless of t's own location — e.g. time.Now() at 11:26:16+05:30 becomes "2026-09-28T05-56-16Z".

Always UTC, deliberately: this format is used for machine-generated, embedded-in-a-filename timestamps (snapshot archive names, quarantine collision suffixes) where "lexical order == chronological order" is relied on elsewhere (ApplyRetention's snapshot pruning). Local time can move backward in wall-clock terms across a DST "fall back" transition, which would silently break that invariant; UTC has no DST, so it can't.

func FilenameUTCNow

func FilenameUTCNow() string

FilenameUTCNow is FilenameUTC(time.Now()).

func LocalRFC3339

func LocalRFC3339(t time.Time) string

LocalRFC3339 formats t as local time in RFC3339, with a numeric UTC offset — e.g. "2026-09-28T11:26:16+05:30". Used for anything a person reads directly: structured log entries, gitback health's generated_at, mirrors.json's sync times.

func LocalRFC3339Now

func LocalRFC3339Now() string

LocalRFC3339Now is LocalRFC3339(time.Now()).

Types

This section is empty.

Jump to

Keyboard shortcuts

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