Created
May 4, 2009 22:32
-
-
Save jpf/106715 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # hexdate.sh | |
| # Gives the hexadecmial representation of time_t | |
| # If the hexadecimal representation of time_t is given as an argument, will print the date that time represented. | |
| # | |
| # Joel Franusic, 49ff6dcc | |
| if [ $# -eq 0 ]; then | |
| echo "obase=16;`date +%s`" | bc | tr '[A-Z]' '[a-z]' | |
| else | |
| HEXTIME=$(echo $1 | tr '[a-z]' '[A-Z]') | |
| TIME_T=$(echo "ibase=16; $HEXTIME" | bc) | |
| date -r $TIME_T | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment