Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime wrapper rounds to nearest second #35

Open
sjanic opened this issue Oct 20, 2020 · 0 comments
Open

DateTime wrapper rounds to nearest second #35

sjanic opened this issue Oct 20, 2020 · 0 comments

Comments

@sjanic
Copy link

sjanic commented Oct 20, 2020

Given this example

func testExample() throws {
  let start = DateTime(
    date: FHIRDate(string: "1990-08-17")!,
    time: FHIRTime(hour: 12, minute: 8, second: 20.99999),
    timeZone: TimeZone.current
  )
  print("Start date as json: \(start.description)")
  print("Start date as NSDate: \(start.nsDate)")
}

I get the following output

Start date as json: 1990-08-17T12:08:21+02:00
Start date as NSDate: 1990-08-17 10:08:20 +0000

I'm wondering why the DateTime rounds up to the nearest second (it has a precision of 4 decimals of milliseconds), when the NSDate doesn't. Is this an issue (it could potentially mean that something happen a second earlier/later then expected)?

I'm using Swift-SMART version 4.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant