SwatchTime is a Python program for displaying the current date and time using Swatch Internet Time. It provides a set of flags that are useful for a caller from the CLI or as part of a module for another program; like a Polybar module. Currently the flags are mostly stable, but may be changed in the future to be more like date
.
Copy the python script to a location that is in your path. One way might be...
sudo install -m 0755 swatchtime.py /usr/bin/swatchtime
Automatically
Use an AUR helper like Yay, to install the AUR package; yay -S swatchtime-git
Manually
git clone https://aur.archlinux.org/swatchtime-git.git
cd swatchtime-git
makepkg --install
-h, --help
Print help message and exit
-v, --verbose
Shows the PID a few seconds before starting. (default: False)
-t, --tail
Enables tail output mode. (default: False)
-d, --delay
The delay between refreshes in tail mode; only applies if tail mode is set. (default: 1 second)
-f, --format
A mostly strftime compliant string to format the Swatch Time. A notable addition is a way to denote how and where to format the current .beat. (default: d%d.%m.%y@{Beat}
)
{Beat}
will format the number of beats without left-padding zeros.- Example
swatchtime --format d%d.%m.%y@{beat}
will outputd19.05.19@1
- Example
{beat}
will format the number of beats with padding zeros.- Example
swatchtime --format %Y-%m-%d@{Beat}
will output2019-05-19@001
- Example
--alt-format
Format to switch to after receiving a USR1 signal; only applies if tail output is set. (default: None). Unlike the format argument, this must be a strictly strftime compliant string. Examples:
-
swatchtime -t --alt-format %c
producesThu Jan 4 05:45:16 2019
(similar todate
) -
swatchtime -t --alt-format %Y-%m-%dT%H:%M:%S
produces2019-01-04T04:45:19
(an ISO-8601 string for local time)
-u, --utc, --universal
Displays standard time as UTC (Coordinated Universal Time). (default: False)
swatchtime -t -u --alt-format %Y-%m-%dT%H:%M:%SZ
produces2019-01-04T04:45:19Z
(an ISO-8601 string for Zulu time).
Note: Both format options may be called using 'single-quotes', "double-quotes", or no quotes. Quotation marks are only needed if the formatting string contains a space.
- Another way to communicate with a running instance of swatchtime; probably using a FIFO started using a flag
- i3bar/Waybar module
- Bash auto-completion files
- ZSH auto-completion files
- Fish auto-completion files
- Make a proper Python package, (whatever that means)