[libc-commits] [PATCH] D96684: Changes to mktime to handle invalid dates, overflow and underflow andcalculating the correct date and thenumber of seconds even if invalid datesare passed as arguments.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Feb 19 20:42:30 PST 2021


sivachandra accepted this revision.
sivachandra added a comment.
This revision is now accepted and ready to land.

Please run clang-format if you have not already done so.



================
Comment at: libc/src/time/mktime.h:27
 
+time_t outOfRange();
+
----------------
sivachandra wrote:
> Likewise, you should make this function `static inline` and define it in `time_utils.h` in the nested namespace `__llvm_libc::time_utils`.
Remove this?


================
Comment at: libc/test/src/time/TmMatcher.h:17
+namespace __llvm_libc {
+namespace tmmatcher {
+
----------------
At other places, we followed this convention:

```
namespace __llvm_libc {
namespace time_utils {
namespace testing {
}
}
}
```

It is a bit of verbose nesting but the macro hides the verbosity.


================
Comment at: libc/test/src/time/mktime_test.cpp:78
+              Succeeds(-1));
+  check_mktime(&tm_data,
+               1969, // year
----------------
Do we need this helper function? Wouldn't a pattern like this work:

```
EXPECT_TM_EQ(tm_data, tm{
                                ...
                               });
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96684/new/

https://reviews.llvm.org/D96684



More information about the libc-commits mailing list