Created
November 16, 2009 19:55
-
-
Save jamesgolick/236274 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
| package journalist | |
| import java.util.Date | |
| object FancyInt { | |
| implicit def int2FancyInt(int: Int): FancyInt = new FancyInt(int) | |
| } | |
| class FancyInt(val integer: Int) { | |
| def day: Int = integer * 86400 | |
| def days: Int = day | |
| def hour: Int = integer * 3600 | |
| def hours: Int = hour | |
| def minute: Int = integer * 60 | |
| def minutes: Int = minute | |
| def ago: Date = new Date(System.currentTimeMillis() - integer * 1000) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment