 #!/usr/bin/env swift
 
-#if os(Linux) || os(FreeBSD)
-	import Glibc
-#else
-	import Darwin
-#endif
+import Foundation
 
 var num_steps: Int = 1000000000
-
-// Set up stuff for timing from Glibc.
-// timeval is a Glibc structure.
-var rettime:timeval = timeval(tv_sec: 0, tv_usec: 0)
 
 if CommandLine.arguments.count == 2 {
     num_steps = Int(CommandLine.arguments[1])!;


var pi: Double = total_sim * step

// Get time of day again.
gettimeofday(&rettime, nil)
var stop: Double = Double(rettime.tv_sec) + (Double(rettime.tv_usec)/1000000)

print("Obtained value of PI: " + String(pi))
print("Time taken: " + String(stop - start) + " seconds")

var total_sim: Double = 0.0
var step: Double = 1.0/Double(num_steps)

// Get time.
let start = Date()

for i in 1...num_steps {
    var x: Double = (Double(i) - 0.5) * step
