Skip to content

Instantly share code, notes, and snippets.

@shizone
Created July 13, 2012 07:19
Show Gist options
  • Save shizone/3103324 to your computer and use it in GitHub Desktop.
Save shizone/3103324 to your computer and use it in GitHub Desktop.
java.util.Date#getTime同士の比較でズレが出る回数の検証
scala> import java.util.Date
def f(n: Int): Int =
if (new Date().getTime != new Date().getTime) n else f(n + 1)
f(0)
import java.util.Date
f: (n: Int)Int
res0: Int = 15090
scala> f(0)
res1: Int = 52401
scala> f(0)
res2: Int = 92710
scala> f(0)
res3: Int = 15164
scala> f(0)
res4: Int = 2428
scala> f(0)
res5: Int = 95967
scala> f(0)
res6: Int = 115217
scala> f(0)
res7: Int = 193177
scala> f(0)
res8: Int = 4684
scala> f(0)
res9: Int = 48757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment