Skip to content

Commit

Permalink
Extract generation of current date into function
Browse files Browse the repository at this point in the history
  • Loading branch information
lauft committed Mar 2, 2019
1 parent e6b4091 commit f05596f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/timemachine
@@ -1,5 +1,10 @@
#!/bin/bash

function current_date()
{
date --rfc-3339=date
}

function random_minute()
{
echo "0$( rand -M 60 )" | sed "s|.\+\(..\)\$|\1|g"
Expand Down Expand Up @@ -44,7 +49,7 @@ until [[ -z "${1}" ]] ; do
shift
done

for day in ${days-$(date --rfc-3339=date)} ; do
for day in ${days-$( current_date )} ; do
for minute in ${minutes-$( random_minute )} ; do
for hour in ${hours-$( default_hours )} ; do
date="${day}T${hour}:${minute}"
Expand Down

0 comments on commit f05596f

Please sign in to comment.