You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some ugly hacks (too ugly to submit) that basically pass Seconds to beer_o_clock() as parameters. The If $2 -gt $1 still works and it eliminates the need for the datediff function.
local secs=$(date -d 'now' +"%s")
local beer_is_at=16
local beer_seconds=$(date -d "today ${beer_is_at}:00:00" '+%s')
And call with
case $day in
[1-5]*) beer_o_clock $beer_seconds $hrs;; # mon - fri
It makes this much cleaner too:
local hrsUntil=$(( ($1 - $2) / 60 / 60 ))
local minUntil=$(( ($1 - $2) / 60 ))
Just my $0.02. Was fun playing with this.
The text was updated successfully, but these errors were encountered:
I have some ugly hacks (too ugly to submit) that basically pass Seconds to beer_o_clock() as parameters. The If $2 -gt $1 still works and it eliminates the need for the datediff function.
local secs=$(date -d 'now' +"%s")
local beer_is_at=16
local beer_seconds=$(date -d "today ${beer_is_at}:00:00" '+%s')
And call with
case $day in
[1-5]*) beer_o_clock $beer_seconds $hrs;; # mon - fri
It makes this much cleaner too:
local hrsUntil=$(( ($1 - $2) / 60 / 60 ))
local minUntil=$(( ($1 - $2) / 60 ))
Just my $0.02. Was fun playing with this.
The text was updated successfully, but these errors were encountered: