utils

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeReportFile = UserConfigHour()

Functions

func UserConfigHour

func UserConfigHour() (dateHour time.Duration)

UserConfigHour calculates the duration until the next occurrence of the configured hour (Config.GenerateLogsOptions.Hour) on the current or following day.

Returns:

  • time.Duration: The time remaining to reach the target hour. If the hour has already passed today, it returns the duration until that same hour on the following day.

The function performs:

  • Retrieves the hour string from options.Config.GenerateLogsOptions.Hour (expected format: "15:04:05").
  • Parses the hour using time.Parse. If the format is invalid, the program terminates with log.Fatal.
  • Constructs a time.Time object for today at the parsed hour, using the current local time zone.
  • Calculates the difference between that target time and the current moment (time.Now()).
  • If the difference is negative (the hour has already passed), it adds 24 hours to target the next day.
  • Returns the resulting duration.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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