PureSwift / SwiftFoundation

Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux)
MIT License
625 stars 52 forks source link

add init to Date: millisecondsSince1970 #13

Closed nmn closed 8 years ago

nmn commented 8 years ago

This convenience initializer take milliseconds as Long instead of a Double value of seconds. This is similar to the Date class in Javascript, and is useful for many JSON APIs that use number of milliseconds since epoch to represent dates.

Further I think the word TimeInterval should be renamed to Seconds in the API of the Date object to be less vague.

colemancda commented 8 years ago

If you provide a unit test case (or a couple) then I would be willing to take another look and merge it. Right now the unit tests are failing on your fork.

colemancda commented 8 years ago

@nmn

/Users/travis/build/PureSwift/SwiftFoundation/Sources/Date.swift:68:43: error: use of undeclared type 'Long'
    public init(millisecondsSince1970 ms: Long) {
                                          ^~~~

Have you tried compiling this on your machine?