Browse Source

There it is.

master
Bandie Yip Kojote 5 years ago
parent
commit
6ce6bd4822
  1. 17
      README.md
  2. 24
      decimaltime

17
README.md

@ -1 +1,16 @@
# decimaltime
# decimaltime
## Before using
Just make it executable: `chmod +x decimaltime`
## Usage
./decimaltime
## Options
Within the bash script you have the option to put decimal miliseconds behind it seperated by point, comma or what ever (as LC\_NUMERIC says).
To show it, switch `decimalplace=false` to `decimalplace=true`.

24
decimaltime

@ -0,0 +1,24 @@
#!/bin/bash
# Author: Bandie Yip Kojote
# Licence: GNU-GPLv3
# Year: 2016
# Shows dh:dm:ds.dms if true
decimalplace=false
dm=$(awk --use-lc-numeric -v dp="$decimalplace" -v h="$(date +%k)" -v m="$(date +%M)" -v s="$(date +%S)" '
BEGIN{
t=( ( (h * 60 * 60) + (m * 60) + s ) / 0.864 );
dh=int(t/10000);
dm=int((t-(dh*10000))/100);
ds=(t-(dh*10000)-(dm*100));
if (dp=="true") {
printf("%d:%02d:%04.1f", dh, dm, ds);
}
else {
printf("%d:%02d:%02d", dh, dm, ds);
}
}')
echo -e "${dm}"
Loading…
Cancel
Save