I'm new to iOS and Swift and I'm trying to get the current time in milliseconds since the Unix epoch. I have a global computed variable defined like this:
var currentTimeInMs: NSTimeInterval {
return NSDate().timeIntervalSince1970 * 1000
}
The value I get back from this variable contains a fractional component. For example:
1464958907683.18
I need to use this value as a JSON parameter to a web request and the API does not like the fractional portion of this value. Is it possible to truncate this value so I just get back 1464958907683
instead of 1464958907683.18
?