llvm-project/lldb/source
Raphael Isemann 5814255e1a [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
2020-07-06 16:59:37 +02:00
..
API [lldb][NFC] Remove an unnecessary cast in SBCommandInterpreter 2020-07-05 10:54:18 +02:00
Breakpoint [lldb][NFC] Clarify that spaces can't be in breakpoint names 2020-07-05 10:55:02 +02:00
Commands [lldb] Replace StringConvert with llvm::to_integer when parsing integer values in CommandObjects 2020-07-01 17:19:31 +02:00
Core [lldb] Fix type conversion in the Scalar getters 2020-07-02 18:02:57 +02:00
DataFormatters [lldb] Small improvements in ValueObjectPrinter::PrintDecl (NFC) 2020-06-12 21:05:05 -07:00
Expression [lldb] Fix missing characters when autocompleting LLDB commands in REPL 2020-07-03 12:10:00 +02:00
Host [lldb] Use std::make_unique<> (NFC) 2020-06-24 17:48:40 -07:00
Initialization [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
Interpreter [lldb/ScriptInterpreter] Fix missing include on Windows 2020-06-25 12:19:04 -07:00
Plugins [lldb] Always round down in NSDate's formatter to match NSDate's builtin format 2020-07-06 16:59:37 +02:00
Symbol [lldb] Use std::make_unique<> (NFC) 2020-06-24 17:48:40 -07:00
Target [lldb] Use std::make_unique<> (NFC) 2020-06-24 17:48:40 -07:00
Utility [lldb/Utility] Merge Scalar::Get(Value)TypeAsCString 2020-07-06 10:34:12 +02:00
CMakeLists.txt Make LLVM_APPEND_VC_REV=OFF affect clang, lld, and lldb as well. 2020-01-16 19:04:08 -05:00
lldb.cpp [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY 2020-02-20 10:07:50 -08:00