Bug 255033

Summary: Web Inspector: Console: timestamps are always wrong
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: hi, inspector-bugzilla-changes, jasmine.mok, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 248240    
Bug Blocks:    

Description Devin Rousso 2023-04-05 08:20:29 PDT
1. log any message
2. compare to time on your computer
Comment 1 Radar WebKit Bug Importer 2023-04-05 08:20:45 PDT
<rdar://problem/107660054>
Comment 2 Jasmine 2023-04-14 11:01:01 PDT
I was able to reproduce this bug on macOS. It does not reproduce on Windows.

It looks like there's an issue with how MonotonicTime::now() is implemented for OS(DARWIN): https://github.com/WebKit/WebKit/blob/main/Source/WTF/wtf/CurrentTime.cpp#L265-L266

At 6:41 PM I output the following:
mach_absolute_time(): 2410267093664
fromMachAbsoluteTime(mach_absolute_time()): Monotonic(100427.795617 sec)
MonotonicTime::now(): Monotonic(100427.795629 sec)
Seconds(MonotonicTime::now().secondsSinceEpoch()): 100427.795569 sec

Converting 100427.795617 seconds to a timestamp yielded 19:53:47.795

When I commented out the OS(DARWIN) implementation of MonotonicTime::now() and tested again at 6:46 PM I got the correct timestamp of 18:46:54.921
Comment 3 Devin Rousso 2023-04-14 14:58:35 PDT
very odd.  id expect more things to be broken if this is that off 🤔

im pretty sure JS `Date` uses `WallTime`.  perhaps we should be using that here too?
Comment 4 Devin Rousso 2023-04-16 19:54:23 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12782
Comment 5 EWS 2023-04-21 13:20:44 PDT
Committed 263261@main (1eb0aa379232): <https://commits.webkit.org/263261@main>

Reviewed commits have been landed. Closing PR #12782 and removing active labels.