Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

⌚️ Tiny world clock in Go!

License

NotificationsYou must be signed in to change notification settings

Neved4/gotwc

GoCodeQLHomebrew

gotwc - Tiny world clock in Go! 🚀

Fast, CLI world clock that displays time zone information usingtz database to read validtz entries.

$gotwc -h -f tools/samples/tz-small.confAmerica/New_York     2023-12-11 12:37:13America/Los_Angeles  2023-12-11 09:37:13UTC                  2023-12-11 17:37:13Europe/London        2023-12-11 17:37:13Europe/Paris         2023-12-11 18:37:13Asia/Tokyo           2023-12-12 02:37:13Australia/Sydney     2023-12-12 04:37:13

Highlights

  • 🚀Fast -10X times faster thantwc.c and65X timesfaster thandate.1
    Only ≈7 ms for one entry, and ≈177 ms for ≈ 600entries.
  • 🔒Robust - tested to work with alltz database entries,version 2023c.
  • 📦Self-contained - zero dependencies,lightweight (110 lines,2458 bytes).

Getting Started

Prerequisites

If you are buildinggotwc, you'll need:

  • AGo compiler

Installing

If you haveHomebrew installed, just run:

brew install Neved4/homebrew-tap/gotwc

Alternatively, clone the repository:

git clone https://github.com/Neved4/gotwc

Then build:

go build

Usage

The following usage and options are available:

gotwc [-h] [-f path] [-s format] [-t timezone] ...Options:  -f path      Read config from path (default "$HOME/.config/twc/tz.conf")  -h      Print in human-readable format  -s format      Set desired time format (e.g. "%Y-%m-%d")  -t timezone      specific timezone (e.g. "Asia/Tokyo")Examples:  Print Tokyo's date in a human-readable format with YY-MM-DD format:    $ gotwc -h -s %Y-%m-%d -t Asia/Tokyo    Asia/Tokyo  2024-01-02 15:04:05    Print date in Los Angeles using an environment variable for the timezone:      $ TZ=America/Los_Angeles gotwc    2024-01-02T15:04:05-0800Environment:  XDG_CONFIG_HOME    When defined, it will be used to store the tz.conf file.  TZ    Timezone to use when displaying dates.Files:  ~/.config/twc/tz.conf    Stores tz database entries to be displayed.See also:  environ(7)

Docker

To compile the binary inside aDocker image, run:

docker build.

Compatibility

Runs onLinux,macOS and*BSD systems on bothx86_64 andarm64.

Standards

gotwc should run on mostPOSIX.1-20172 compatible systems andproduceISO 86013 output.

License

gotwc is licensed under the terms of theMIT License.

See theLICENSE file for details.

Related Projects

Footnotes

  1. cfr.date command takes ≈931 ms when iterating over ≈ 600entries. Measured withhyperfine.

  2. IEEE Std 1003.1-2017: Standard for Information Technology— Portable Operating System Interface (POSIX®),
    ISO/IEC/IEEE 9945:2009/COR 2:2017. URL:https://pubs.opengroup.org/onlinepubs/9699919799/

  3. ISO 8601: Date and time \ — Representations for information interchange, ISO 8601-1:2019.
    URL:https://www.iso.org/obp/ui/#iso:std:iso:8601:-2:ed-1:v1:en

About

⌚️ Tiny world clock in Go!

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp