util

package
v0.0.0-...-6f0d0d7 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const InfDuration = time.Duration(math.MaxInt64)
View Source
const MsgNoActiveContracts = "No active contracts. Focus on growing the home farm!"

Variables

View Source
var HTMLMsgNoActiveContracts = HTMLMsg(MsgNoActiveContracts)
View Source
var Units = []Unit{
	{"M", 6},
	{"B", 9},
	{"T", 12},
	{"q", 15},
	{"Q", 18},
	{"s", 21},
	{"S", 24},
	{"o", 27},
	{"N", 30},
	{"d", 33},
	{"U", 36},
	{"D", 39},
	{"Td", 42},
	{"qd", 45},
	{"Qd", 48},
	{"sd", 51},
	{"Sd", 54},
	{"Od", 57},
	{"Nd", 60},
	{"V", 63},
	{"uV", 66},
	{"dV", 69},
	{"tV", 72},
	{"qV", 75},
	{"QV", 78},
	{"sV", 81},
	{"SV", 84},
	{"OV", 87},
	{"NV", 90},
	{"tT", 93},
}

https://egg-inc.fandom.com/wiki/Order_of_Magnitude

Functions

func DoubleToDuration

func DoubleToDuration(d float64) time.Duration

DoubleToDuration converts a float64 number of seconds to Duration. +/-InfDuration is returned in the event of overflow.

func DoubleToTime

func DoubleToTime(t float64) time.Time

DoubleToTime converts an epoch timestamp in seconds to Time. Overflow is not considered.

func FormatCountdown

func FormatCountdown(d time.Duration) string

func FormatDate

func FormatDate(t time.Time) string

func FormatDateCasual

func FormatDateCasual(t time.Time) string

func FormatDatetime

func FormatDatetime(t time.Time) string

func FormatDuration

func FormatDuration(d time.Duration) string

func FormatDurationHM

func FormatDurationHM(d time.Duration) string

func FormatDurationNonNegative

func FormatDurationNonNegative(d time.Duration) string

func FormatDurationWhole

func FormatDurationWhole(d time.Duration) string

func FormatPercentage

func FormatPercentage(x float64, decimalDigits uint) string

func FormatTime

func FormatTime(t time.Time) string

func FormatTimeCasual

func FormatTimeCasual(t time.Time) string

func HTMLMsg

func HTMLMsg(m string) template.HTML

func Numfmt

func Numfmt(x float64) string

func NumfmtFlexible

func NumfmtFlexible(x float64, decimalDigits uint, trimTrailingZeros bool) string

func NumfmtWhole

func NumfmtWhole(x float64) string

func PrintTable

func PrintTable(t [][]string)

func TimeToDouble

func TimeToDouble(t time.Time) float64

Types

type Unit

type Unit struct {
	Symbol string
	OoM    int
}

Jump to

Keyboard shortcuts

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