Skip to content

Instantly share code, notes, and snippets.

@kisielk
Created August 26, 2012 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kisielk/3475026 to your computer and use it in GitHub Desktop.
Save kisielk/3475026 to your computer and use it in GitHub Desktop.
My god what have I done...
var units = map[string]int{
"s": 1,
"sec": 1,
"secs": 1,
"second": 1,
"seconds": 1,
"m": 60,
"min": 60,
"mins": 60,
"minute": 60,
"minutes": 60,
"h": 60 * 60,
"hr": 60 * 60,
"hrs": 60 * 60,
"hour": 60 * 60,
"hours": 60 * 60,
"d": 60 * 60 * 24,
"day": 60 * 60 * 24,
"days": 60 * 60 * 24,
"w": 60 * 60 * 24 * 7,
"week": 60 * 60 * 24 * 7,
"weeks": 60 * 60 * 24 * 7,
"M": 60 * 60 * 24 * 30,
"month": 60 * 60 * 24 * 30,
"months": 60 * 60 * 24 * 30,
"Y": 60 * 60 * 24 * 365,
"year": 60 * 60 * 24 * 365,
"years": 60 * 60 * 24 * 365,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment