Repository navigation
Releases: ThatGuyCodes605/BetterDate
Release list
v1.8
Installation Linux MacOS and BSD
make
sudo make install
Installation Windows (you got to have GNUMake installed)
make
Full Changelog: v1.7...v1.8
v1.7
Features
- ⏰ Real-time clock with configurable precision (milliseconds, microseconds, nanoseconds)
- 🕐 Both 24-hour (default) and 12-hour format support with AM/PM
- 🌍 Timezone support - view time in any timezone worldwide
- 📅 Unix epoch timestamp display (optional)
- 🇺🇸 US date format support - switch between DD/MM/YYYY and MM/DD/YYYY
- ⏱️ Built-in stopwatch - countdown timer with alarm beeps
- 🎛️ Customizable display - hide date, epoch, seconds, or milliseconds
- 🖥️ Clean, in-place updating display without flickering or scrolling
- ⚡ Efficient - automatically adjusts update rate based on precision level
- 🛑 Graceful exit handling with Ctrl+C
- 🐧 Multi-platform support (Linux, macOS, all BSDs, Windows)
- 📖 No external dependencies
Platform Support
Works on Linux (full nanosecond precision), macOS (microsecond precision), FreeBSD, OpenBSD, NetBSD, DragonflyBSD, and Windows (via MinGW/Cygwin/MSYS2).
v1.6
BetterDate Wiki
Home
BetterDate is an improved version of the standard Unix date command. It's a feature-rich terminal-based clock written in C that displays real-time updates with configurable precision (milliseconds, microseconds, or nanoseconds), timezone support, customizable date/time formats, and a built-in stopwatch timer.
Features
- ⏰ Real-time clock with configurable precision (milliseconds, microseconds, nanoseconds)
- 🕐 Both 24-hour (default) and 12-hour format support with AM/PM
- 🌍 Timezone support - view time in any timezone worldwide
- 📅 Unix epoch timestamp display (optional)
- 🇺🇸 US date format support - switch between DD/MM/YYYY and MM/DD/YYYY
- ⏱️ Built-in stopwatch - countdown timer with alarm beeps
- 🎛️ Customizable display - hide seconds, hide milliseconds, show high precision
- 🖥️ Clean, in-place updating display without flickering or scrolling
- ⚡ Efficient - automatically adjusts update rate based on precision level
- 🛑 Graceful exit handling with Ctrl+C
- 🐧 Multi-platform support (Linux, macOS, all BSDs, Windows)
- 📖 No external dependencies
Platform Support
Works on Linux (full nanosecond precision), macOS (microsecond precision), FreeBSD, OpenBSD, NetBSD, DragonflyBSD, and Windows (via MinGW/Cygwin/MSYS2).
Example Output
Default (DD/MM/YYYY, milliseconds):
Epoch: 1737000000
Date: 15/01/2026 Time: 18:41:13.123
US format (MM/DD/YYYY):
Epoch: 1737000000
Date: 01/15/2026 Time: 18:41:13.123
12-hour with no milliseconds:
Epoch: 1737000000
Date: 15/01/2026 Time: 06:41:13 PM
No seconds (HH:MM only):
Epoch: 1737000000
Date: 15/01/2026 Time: 18:41
With nanoseconds:
Epoch: 1737000000
Date: 15/01/2026 Time: 18:41:13.123.456.789
Stopwatch:
Stopwatch started for 5.000000 minutes. Press Ctrl+C to stop.
Time left: 04:59
All displays refresh smoothly in place.
Installation
Quick Install (from source)
# Clone the repository
git clone https://github.com/ThatGuyCodes605/BetterDate.git
cd BetterDate
# Build and install
make
sudo make installThe program will be installed to /usr/local/bin/betterdate.
Uninstall
cd BetterDate
sudo make uninstallUsage
Basic Usage
Default display (24-hour, DD/MM/YYYY, milliseconds, with epoch):
betterdate12-hour format with AM/PM:
betterdate -12US date format (MM/DD/YYYY):
betterdate -USHide milliseconds:
betterdate -NMOutput: Time: 18:41:13
Hide seconds:
betterdate -NSOutput: Time: 18:41
Microseconds precision:
betterdate -msOutput: Time: 18:41:13.123.456
Nanoseconds precision:
betterdate -nsOutput: Time: 18:41:13.123.456.789
Hide epoch timestamp:
betterdate -neChange timezone:
betterdate -tz UTC
betterdate -tz America/New_York
betterdate -tz Europe/London
betterdate -tz Asia/TokyoStart stopwatch:
betterdate -sw 5 # 5 minutes
betterdate -sw 0.5 # 30 seconds
betterdate -sw 0.1 # 6 secondsShow help:
betterdate -h
betterdate --helpShow version:
betterdate -v
betterdate --versionCombining Options
You can combine multiple flags:
# 12-hour US format with no milliseconds in Tokyo
betterdate -12 -US -NM -tz Asia/Tokyo
# 24-hour UTC with nanoseconds, no epoch
betterdate -tz UTC -ns -ne
# 12-hour format with no seconds
betterdate -12 -NS
# US format with microseconds and no epoch
betterdate -US -ms -neAvailable Flags
| Flag | Description | Example |
|---|---|---|
-12 |
Use 12-hour format with AM/PM | betterdate -12 |
-ne |
Hide epoch timestamp | betterdate -ne |
-ms |
Show microseconds (milliseconds + microseconds) | betterdate -ms |
-ns |
Show nanoseconds (milliseconds + microseconds + nanoseconds) | betterdate -ns |
-tz <timezone> |
Display time in specified timezone | betterdate -tz UTC |
-US |
Use US date format (MM/DD/YYYY) | betterdate -US |
-NM |
Hide milliseconds (No Milliseconds) | betterdate -NM |
-NS |
Hide seconds (No Seconds) | betterdate -NS |
-sw <minutes> |
Start stopwatch countdown timer | betterdate -sw 5 |
-h, --help |
Show help message | betterdate -h |
-v, --version |
Show version information | betterdate -v |
Date Format Options
Default (DD/MM/YYYY):
- 15/01/2026 (15th of January, 2026)
- International standard format
US Format (-US - MM/DD/YYYY):
- 01/15/2026 (January 15th, 2026)
- Common in United States
Time Display Options
Precision Levels:
-
Default: Milliseconds only (3 digits after seconds)
- Format:
HH:MM:SS.mmm - Updates every 1ms with sleep to save CPU
- Format:
-
Microseconds (-ms): Milliseconds + Microseconds (6 digits total)
- Format:
HH:MM:SS.mmm.uuu - Updates as fast as possible (no sleep)
- Format:
-
Nanoseconds (-ns): Milliseconds + Microseconds + Nanoseconds (9 digits total)
- Format:
HH:MM:SS.mmm.uuu.nnn - Updates as fast as possible (no sleep)
- Format:
Visibility Options:
-
No Milliseconds (-NM): Hide all decimal precision
- Format:
HH:MM:SS - Shows seconds only
- Format:
-
No Seconds (-NS): Hide seconds and milliseconds
- Format:
HH:MM - Shows hours and minutes only
- Updates every minute, minimal CPU usage
- Format:
Note: -NM and -NS take priority over -ms and -ns flags.
Stopwatch Feature
The stopwatch is a countdown timer that accepts time in minutes (supports decimals):
# Basic usage
betterdate -sw <minutes>
# Examples
betterdate -sw 5 # 5 minutes
betterdate -sw 1.5 # 1 minute 30 seconds
betterdate -sw 0.5 # 30 seconds
betterdate -sw 0.1 # 6 seconds
betterdate -sw 0.0167 # 1 secondStopwatch behavior:
- Displays countdown in MM:SS format
- Updates every second
- Beeps 5 times when timer finishes (using system bell)
- Press Ctrl+C to stop early
- Automatically exits after completion
Example output:
Stopwatch started for 5.000000 minutes. Press Ctrl+C to stop.
Time left: 04:59
Time left: 04:58
Time left: 04:57
...
Time left: 00:01
Time left: 00:00
Stopwatch finished!
[beep beep beep beep beep]
Common Timezones
Americas:
America/New_York- Eastern TimeAmerica/Chicago- Central TimeAmerica/Denver- Mountain TimeAmerica/Los_Angeles- Pacific TimeAmerica/Sao_Paulo- BrazilAmerica/Mexico_City- Mexico
Europe:
Europe/London- UKEurope/Paris- France/CETEurope/Berlin- GermanyEurope/Moscow- Russia
Asia:
Asia/Tokyo- JapanAsia/Shanghai- ChinaAsia/Dubai- UAEAsia/Kolkata- IndiaAsia/Singapore- Singapore
Pacific:
Australia/Sydney- Australia EastPacific/Auckland- New Zealand
Other:
UTC- Universal Coordinated Time
Exiting the Program
Press Ctrl+C to exit. The program will gracefully restore your terminal cursor.
How It Works
Technical Details
Time Retrieval:
- Uses
clock_gettime()withCLOCK_REALTIMEfor high-precision time - Provides up to nanosecond resolution on supported platforms
- Calculates milliseconds, microseconds, and nanoseconds from
tv_nsec
Display Method:
- Uses ANSI escape codes to control terminal cursor
\033[?25l- Hides cursor for cleaner display\033[2A- Moves cursor up 2 lines (with epoch)\033[1A- Moves cursor up 1 line (without epoch)\033[?25h- Shows cursor again on exit- Overwrites same lines for smooth, flicker-free updates
Time Conversion:
- Unix epoch: raw timestamp (seconds since January 1, 1970)
- Date formatting:
- Default: DD/MM/YYYY
- US format: MM/DD/YYYY (swaps day and month)
- Time precision breakdown:
- Milliseconds:
tv_nsec / 1000000(0-999) - Microseconds:
(tv_nsec / 1000) % 1000(0-999) - Nanoseconds:
tv_nsec % 1000(0-999)
- Milliseconds:
- 12-hour conversion handles midnight (0 → 12 AM) and noon (12 → 12 PM)
Signal Handling:
- Catches
SIGINT(Ctrl+C) for graceful shutdown handle_exit()function ensures cursor is restored before program exits- Prevents terminal from being left in a corrupted state
Timezone Support:
- Uses
setenv("TZ", timezone, 1)to set timezone - Calls
tzset()to apply timezone change - Only affects the running program, not system settings
- Defaults to system timezone if
-tznot specified
Stopwatch Implementation:
- Uses
time()for second-level precision - Calculates elapsed time and remaining time
- Simple countdown display with MM:SS format
- Uses
system("tput bel")for beep sound (5 times) - Hides cursor during countdown, restores on exit
Performance Optimization:
- Default mode: sleeps 1ms between updates (~0.1% CPU)
- High-precision modes (-ms, -ns): no sleep for maximum update rate (~5-10% CPU)
- No seconds mode (-NS): updates every minute (~0% CPU)
- Automatic adjustment based on precision requirements
Building from Source
Prerequisites
- GCC or compatible C compiler
- Make
- Unix-like operating system (Linux, macOS, BSD, Windows with MinGW/Cygwin)
- POSIX-compliant C library
Build Process
-
Clone the repository:
git clone https://github.com/ThatGuyCodes605/BetterDate.git cd BetterDate -
Compile:
make
-
Test locally (without installing):
make run # or ./betterdate -
Install system-wide:
sudo make install
-
**Clean ...
v1.5
Read the WIKI or README to see what's changed
This program works on FreeBSD, OpenBSD, DragonFlyBSD, NetBSD, Linux, macOS, and Windows
betterdate is a real-time clock display that continuously updates to show both the current date/time and Unix epoch timestamp.
How it works:
The program uses ANSI escape codes to control the terminal cursor, moving it up two lines to redraw the time display in the same spot, creating a smooth updating effect.
Platform compatibility:
The program uses clock_gettime() with CLOCK_REALTIME and precise nanosleep timing, which are designed for Linux systems. While it may compile on other platforms, it's intended and tested for Linux, where these POSIX real-time functions work as expected.
To exit the program, press Ctrl+C.
Full Changelog: v1.4...v1.5
v1.4
Read the WIKI or README to see what's changed
This program works on FreeBSD, OpenBSD, DragonFlyBSD, NetBSD, Linux, macOS, and Windows
betterdate is a real-time clock display that continuously updates to show both the current date/time and Unix epoch timestamp.
How it works:
The program uses ANSI escape codes to control the terminal cursor, moving it up two lines to redraw the time display in the same spot, creating a smooth updating effect.
Platform compatibility:
The program uses clock_gettime() with CLOCK_REALTIME and precise nanosleep timing, which are designed for Linux systems. While it may compile on other platforms, it's intended and tested for Linux, where these POSIX real-time functions work as expected.
To exit the program, press Ctrl+C.
Full Changelog: v1.3...v1.4
v1.3
Read the WIKI or README to see what's changed
This program works on FreeBSD, OpenBSD, DragonFlyBSD, NetBSD, Linux, macOS, and Windows
betterdate is a real-time clock display that continuously updates to show both the current date/time and Unix epoch timestamp.
How it works:
The program uses ANSI escape codes to control the terminal cursor, moving it up two lines to redraw the time display in the same spot, creating a smooth updating effect.
Platform compatibility:
The program uses clock_gettime() with CLOCK_REALTIME and precise nanosleep timing, which are designed for Linux systems. While it may compile on other platforms, it's intended and tested for Linux, where these POSIX real-time functions work as expected.
To exit the program, press Ctrl+C.
Full Changelog: v1.2...v1.3
v1.2
14 Janbetterdate - Real-time Clock Display
betterdate is a real-time clock display that continuously updates to show both the current date/time and Unix epoch timestamp.
What it does:
Displays the Unix epoch (seconds since January 1, 1970)
Shows the current date and time with millisecond precision
Updates in place every millisecond without scrolling the terminal
Hides the cursor while running for a cleaner display
How it works:
The program uses ANSI escape codes to control the terminal cursor, moving it up two lines to redraw the time display in the same spot, creating a smooth updating effect.
Platform compatibility:
The program uses clock_gettime() with CLOCK_REALTIME and precise nanosleep timing, which are designed for Linux systems. While it may compile on other platforms, it's intended and tested for Linux where these POSIX real-time functions work as expected.
To exit the program, press Ctrl+C.
Full Changelog: v1.1...v1.2
v1.1
betterdate - Real-time Clock Display
betterdate is a real-time clock display that continuously updates to show both the current date/time and Unix epoch timestamp.
What it does:
Displays the Unix epoch (seconds since January 1, 1970)
Shows the current date and time with millisecond precision
Updates in place every millisecond without scrolling the terminal
Hides the cursor while running for a cleaner display
Use -12 to get 12 hour time
How it works:
The program uses ANSI escape codes to control the terminal cursor, moving it up two lines to redraw the time display in the same spot, creating a smooth updating effect.
Platform compatibility:
The program uses clock_gettime() with CLOCK_REALTIME and precise nanosleep timing, which are designed for Linux systems. While it may compile on other platforms, it's intended and tested for Linux where these POSIX real-time functions work as expected.
To exit the program, press Ctrl+C.
Full Changelog: v1.0...v1.1
v1.0
betterdate - Real-time Clock Display
betterdate is a real-time clock display that continuously updates to show both the current date/time and Unix epoch timestamp.
What it does:
Displays the Unix epoch (seconds since January 1, 1970)
Shows the current date and time with millisecond precision
Updates in place every millisecond without scrolling the terminal
Hides the cursor while running for a cleaner display
How it works:
The program uses ANSI escape codes to control the terminal cursor, moving it up two lines to redraw the time display in the same spot, creating a smooth updating effect.
Platform compatibility:
The program uses clock_gettime() with CLOCK_REALTIME and precise nanosleep timing, which are designed for Linux systems. While it may compile on other platforms, it's intended and tested for Linux where these POSIX real-time functions work as expected.
To exit the program, press Ctrl+C.
Full Changelog: https://github.com/ThatGuyCodes605/BetterDate/commits/v1.0