Fix/setting unix time stamp to input tap detection #899
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Description
🔗 Jira Ticket M2-7967
This pull request fixes an issue with how timestamps were being calculated using CACurrentMediaTime() in our native Swift component. Initially, CACurrentMediaTime() was used directly, but it was being misinterpreted as a UNIX timestamp, leading to incorrect results. This change adds a method to generate a correct UNIX timestamps.
CACurrentMediaTime() returns the elapsed time since the system's boot (in seconds), but it does not correspond to an absolute timestamp or the UNIX epoch (1970-01-01). Using it directly caused several issues such as incorrect date format.
To address this, I added a new method called bootTime. This method calculates the system's boot time offset by subtracting the CACurrentMediaTime() from the current time (Date().timeIntervalSince1970). This ensures that we can correctly adjust the time provided by CACurrentMediaTime() and treat it as an accurate UNIX timestamp.
The new bootTime value is used to adjust the CACurrentMediaTime() result, so that the calculated timestamps are now consistent with actual calendar dates and times.
📸 Screenshots
Comparison:
sample of new unix date:
Code hight lights:
🪤 Peer Testing
Before:
Input will be ignored the longer you wait to tap the button (disabled state)
Expected:
now you will be able to click all the times.