The Problem

Many desktop widgets display time, but few give a visually rich, split‑zone clock that shows both a primary time zone with seconds and a secondary zone for quick reference. Users who need an always‑on‑screen IST clock with a compact Pacific‑time inset lack a lightweight, open‑source option that runs on Linux without a heavyweight UI framework.

What This Does

The repository builds a single binary flipclock that renders a flip‑style clock using raylib. The main display shows Indian Standard Time (IST) with seconds and the date; a smaller inset shows Pacific Time (PT).

  • main.c contains the application logic, including time fetching (localtime_r), texture generation for digit faces, and the flip animation.
  • Makefile drives compilation, locating raylib via pkg-config, a vendored copy in ./vendor, or a system header. It also defines the FLIP_SECONDS compile‑time knob controlling animation speed.
  • README.md documents the build/run workflow and the rendering approach, while LICENSE and screenshot.png are ancillary.

How It Is Wired

Entry point – execution starts in main.c at int main(void).

  1. Initialization – Calls InitWindow, SetTargetFPS, and SetExitKey (overridden to disable Escape). It then loads fonts via LoadFont from a hard‑coded priority list (DejaVu, Liberation, Noto, Inter).
  2. Time preparation – Each frame, clock_gettime(CLOCK_MONOTONIC, …) supplies a high‑resolution timestamp. The code computes the anchor second using localtime_r after temporarily adjusting TZ to the target zone (IST or PT). This isolates DST handling to the OS.
  3. Texture bakingRenderTexture2D objects are created for each digit at 2× resolution, filtered down to the display size. The bake occurs on window resize and is debounced to avoid thrashing.
  4. Flip animationUpdateFlip calculates the current animation phase as a fraction of FLIP_SECONDS. The quad representing the flipping card is rotated about its hinge edge; the visible height is scaled by cos(angle) to simulate foreshortening. No easing is applied, keeping the motion linear.
  5. Render loopBeginDrawing → draw background → draw pre‑baked digit textures → draw active flip quads → EndDrawing. The loop runs until the window is closed.
  6. ShutdownCloseWindow releases all raylib resources.

All I/O is confined to the local display; there are no network, filesystem, or database interactions. The sole external dependency is the raylib library, resolved at build time via the Makefile logic.

How To Use It

# Clone the repo
git clone https://github.com/moses-y/flip-clock
cd flip-clock

# Build (uses system raylib if available, otherwise vendor)
make

# Optional: build with vendored raylib (stand‑alone binary)
make vendor

# Run the clock
./flipclock

Toggle fullscreen with F11 or F. To restore the default Escape‑to‑quit behavior, edit main.c and set SetExitKey(KEY_ESCAPE). Adjust animation speed, e.g.:

make CFLAGS="-O2 -DFLIP_SECONDS=0.6f"

No configuration files or environment variables are required beyond an installed raylib runtime.

Real‑World Use

A network operations center could launch ./flipclock on a dedicated monitor to show IST (the primary shift for many Asian teams) while keeping PT visible for West‑coast collaborators. The binary’s small footprint (≈ 5 MB) and lack of window manager dependencies make it suitable for lightweight X11 or Wayland sessions.

Code Health & Issues

  • Medium – Untested code paths – repository root – No test suite (*_test.c or similar) is present, so functional regressions are not automatically caught.
  • Medium – Missing CI/CD – repository root – No .github/ workflows, Makefile targets, or other CI configuration; builds are manual.
  • Low – License file present but unspecified – LICENSE – The file exists but the SPDX identifier is not shown in the repository metadata; verify compatibility with downstream use.

Static analysis did not reveal compilation warnings with the default make command on a recent GCC/Clang toolchain.

The Bottom Line

flip-clock delivers a tidy, self‑contained flip‑style clock with dual‑zone display and a clear build process. It is well‑structured for a single‑binary C project but lacks automated testing and CI, which raises maintenance risk for any future extensions. Suitable for developers needing a quick visual time widget on Linux; less appropriate for production environments that require verified stability pipelines.