#!/bin/sh set -eu # Simple LTC-like line generator to feed into a PTY for development. # It outputs lines like: "LOCK HH:MM:SS;FF 25.00" # Configure frames-per-second via LTC_FPS environment variable (23,24,25,29,30 supported). FPS="${LTC_FPS:-25}" case "$FPS" in 23) PERIOD="0.0417083"; RATE_STR="23.98" ;; 24) PERIOD="0.0416667"; RATE_STR="24.00" ;; 25) PERIOD="0.0400000"; RATE_STR="25.00" ;; 29) PERIOD="0.0333667"; RATE_STR="29.97" ;; 30) PERIOD="0.0333333"; RATE_STR="30.00" ;; *) PERIOD="0.0400000"; RATE_STR="25.00"; FPS="25" ;; esac h=12 m=0 s=0 f=0 while true; do printf "[LOCK] %02d:%02d:%02d;%02d | %sfps\r\n" "$h" "$m" "$s" "$f" "$RATE_STR" # increment frame f=$((f+1)) if [ "$f" -ge "$FPS" ]; then f=0 s=$((s+1)) if [ "$s" -ge 60 ]; then s=0 m=$((m+1)) if [ "$m" -ge 60 ]; then m=0 h=$(( (h + 1) % 24 )) fi fi fi # sleep to approximate frame cadence sleep "$PERIOD" done