[all-commits] [llvm/llvm-project] 581425: [lldb] Always round down in NSDate's formatter to ...
Raphael Isemann via All-commits
all-commits at lists.llvm.org
Mon Jul 6 08:00:11 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 5814255e1a7d2e90580d6df457ddd13b1cd156cb
https://github.com/llvm/llvm-project/commit/5814255e1a7d2e90580d6df457ddd13b1cd156cb
Author: Raphael Isemann <teemperor at gmail.com>
Date: 2020-07-06 (Mon, 06 Jul 2020)
Changed paths:
M lldb/source/Plugins/Language/ObjC/Cocoa.cpp
M lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSDate.py
M lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
Log Message:
-----------
[lldb] Always round down in NSDate's formatter to match NSDate's builtin format
Summary:
When printing an NSDate (for example with `NSLog` or `po`) the seconds value is
always rounded down. LLDB's own formatter however isn't following that behaviour
which leads to situations where the formatted result is sometimes one second
off. For example:
```
(lldb) p [NSDate dateWithTimeIntervalSince1970:0.1]
(__NSTaggedDate *) $1 = [...] 1970-01-01 00:00:01 UTC
(lldb) po [NSDate dateWithTimeIntervalSince1970:0.1]
1970-01-01 00:00:00 +0000
(lldb) p [NSDate dateWithTimeIntervalSince1970:0.6]
(__NSTaggedDate *) $4 =[...] 1970-01-01 00:00:01 UTC
(lldb) po [NSDate dateWithTimeIntervalSince1970:0.6]
1970-01-01 00:00:00 +0000
```
This patch just always rounds down the seconds value we get from the NSDate
object.
Fixes rdar://65084800
Reviewers: mib, davide
Reviewed By: mib
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D83221
More information about the All-commits
mailing list