Skip to content

Instantly share code, notes, and snippets.

@landon9720
Created March 8, 2012 17:38
Show Gist options
  • Save landon9720/2002273 to your computer and use it in GitHub Desktop.
Save landon9720/2002273 to your computer and use it in GitHub Desktop.
HumanTime demo
scala> import com.eaio.util.text.HumanTime.{approximately => ht}
import com.eaio.util.text.HumanTime.{approximately=>ht}
scala> ht(0)
res0: java.lang.String = ""
scala> ht(1)
res1: java.lang.String = 1 ms
scala> ht(1000)
res2: java.lang.String = 1 s
scala> ht(1500)
res3: java.lang.String = 1 s 500 ms
scala> ht(11500)
res4: java.lang.String = 11 s 500 ms
scala> ht(111500)
res5: java.lang.String = 2 m
scala> ht(1111500)
res6: java.lang.String = 18 m 31 s
scala> ht(11111500)
res7: java.lang.String = 3 h
scala> ht(111111500)
res8: java.lang.String = 1 d 7 h
scala> ht(1111111500)
res9: java.lang.String = 13 d
scala> ht(111111111500l)
res10: java.lang.String = 3 y 191 d
scala> ht(1111111111500l)
res11: java.lang.String = 35 y 85 d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment