#!/bin/sh now=$(date -u '+%s') midnight=$(date --utc -d 'today 00:00:00' '+%s') echo $((now - midnight))