Created
November 23, 2009 22:30
-
-
Save jamesgolick/241443 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
| 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) | |
| } | |
| // vim: set ts=4 sw=4 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment