aboutsummaryrefslogtreecommitdiff
path: root/lib/time/time.go
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2024-03-05all: comply with linter recommendations #2Shulhan
HTTP request now implicitly create request with context. Any false positive related to not closing HTTP response body has been annotated with "nolint:bodyclose". In the example code, use consistent "// Output:" comment format, by prefixing with single space. Any comment on code now also prefixing with single space. An error returned without variables now use [errors.New] instead of [fmt.Errorf]. Any error returned using [fmt.Errorf] now wrapped using "%w" instead of "%s". Also, replace error checking using [errors.Is] or [errors.As], instead of using equal/not-equal operator. Any statement like "x = x OP y" now replaced with "x OP= y". Also, swap statement is simplified using "x, y = y, x". Any switch statement with single case now replaced with if-condition. Any call to defer on function or program that call [os.Exit], now replaced by calling the deferred function directly. Any if-else condition now replaced with switch statement, if possible.
2023-12-17lib/time: un-export the variable NowShulhan
The original idea of providing Now is to mock the current time in testing Scheduler. Since this variable can be overridden by other packages, it is not safe to export it, hence we un-export it here so it can be used internal only.
2023-12-17lib/time: remove UnixMicro and UnixMilliShulhan
Both of those methods has been added into standard library as [Time.UnixMicro] and [Time.UnixMilli] since Go 1.17.
2023-09-11lib/time: add missing comment to exported error, variables, and constansShulhan
While at it, realign struct in TestScheduler_minutely from 48 to 40 bytes.
2023-02-22lib/time: add global variable Now as functionShulhan
The Now variable return the current local time. Unlike standard library, this is a variable that can be override to mock the current time during testing.
2022-05-09all: reformat all codes using gofmt 1.19 (the Go tip)Shulhan
2021-02-03time: add function UnixMicro that return UNIX time in micro secondsShulhan
While at it, replace the unit tests with an example so we can both do unit testing and provide an examples in documentation.
2020-06-06all: use default linter optionsShulhan
2020-02-28time: add functions to get Unix time in milliseconds (int64 and string)Shulhan
2020-01-20time: change the Microsecond return type from int to int64Shulhan
2019-06-14all: fix nolint formatShulhan
The valid syntax to suppress linter warnings is "//nolint:<name>" with no space between comment and "nolint" and between ":". Also, we move the placement of nolint directive to the top of statements for multiple nolint in the same scope. While at it, fix and supress some linter warnings.
2019-03-01all: fix warnings from linterShulhan
Most of the warnings caused by update to linter which cause global variables declared with grouping "( ... )" and that has been suppressed, are become false-positive again.
2019-02-28time: add function to get micro secondsShulhan
Micro seconds is the first six digits after seconds in output of UnixNano().
2019-02-05lib/time: suppress linter warnings on known global variablesShulhan
2019-02-05lib/email: new package for working with Internet Message FormatShulhan
This package provide library for parsing email message format as specified in RFC 5322.
2018-09-01Add package time with Day and Week as durationShulhan