Skip to content

Commit 57c96e3

Browse files
author
Зишан Мирза
committed
format code with clang-format
1 parent c18b7de commit 57c96e3

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

libc/src/time/time_utils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ LIBC_INLINE int localtime_s(const time_t *t_ptr, struct tm *input) {
193193
if (input == NULL)
194194
return -1;
195195

196-
if ((*t_ptr < 0 || *t_ptr > cpp::numeric_limits<int64_t>::max()) && input != NULL) {
196+
if ((*t_ptr < 0 || *t_ptr > cpp::numeric_limits<int64_t>::max()) &&
197+
input != NULL) {
197198
// setting values to -1 for compatibility reasons
198199
// https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s
199200
input->tm_sec = -1;

libc/test/src/time/localtime_s_test.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp0) {
4242
TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp32Int) {
4343
time_t t_ptr = 2147483647;
4444
struct tm input = (struct tm){.tm_sec = 0,
45-
.tm_min = 0,
46-
.tm_hour = 0,
47-
.tm_mday = 0,
48-
.tm_mon = 0,
49-
.tm_year = 0,
50-
.tm_wday = 0,
51-
.tm_yday = 0,
52-
.tm_isdst = 0};
45+
.tm_min = 0,
46+
.tm_hour = 0,
47+
.tm_mday = 0,
48+
.tm_mon = 0,
49+
.tm_year = 0,
50+
.tm_wday = 0,
51+
.tm_yday = 0,
52+
.tm_isdst = 0};
5353
int result = LIBC_NAMESPACE::localtime_s(&t_ptr, &input);
5454
ASSERT_EQ(0, result);
5555

@@ -67,14 +67,14 @@ TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp32Int) {
6767
TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp32IntDst) {
6868
time_t t_ptr = 1627225465;
6969
struct tm input = (struct tm){.tm_sec = 0,
70-
.tm_min = 0,
71-
.tm_hour = 0,
72-
.tm_mday = 0,
73-
.tm_mon = 0,
74-
.tm_year = 0,
75-
.tm_wday = 0,
76-
.tm_yday = 0,
77-
.tm_isdst = 0};
70+
.tm_min = 0,
71+
.tm_hour = 0,
72+
.tm_mday = 0,
73+
.tm_mon = 0,
74+
.tm_year = 0,
75+
.tm_wday = 0,
76+
.tm_yday = 0,
77+
.tm_isdst = 0};
7878
int result = LIBC_NAMESPACE::localtime_s(&t_ptr, &input);
7979
ASSERT_EQ(0, result);
8080

@@ -92,14 +92,14 @@ TEST(LlvmLibcLocaltimeS, ValidUnixTimestamp32IntDst) {
9292
TEST(LlvmLibcLocaltimeS, InvalidUnixTimestamp) {
9393
time_t t_ptr = -1;
9494
struct tm input = (struct tm){.tm_sec = 0,
95-
.tm_min = 0,
96-
.tm_hour = 0,
97-
.tm_mday = 0,
98-
.tm_mon = 0,
99-
.tm_year = 0,
100-
.tm_wday = 0,
101-
.tm_yday = 0,
102-
.tm_isdst = 0};
95+
.tm_min = 0,
96+
.tm_hour = 0,
97+
.tm_mday = 0,
98+
.tm_mon = 0,
99+
.tm_year = 0,
100+
.tm_wday = 0,
101+
.tm_yday = 0,
102+
.tm_isdst = 0};
103103
int result = LIBC_NAMESPACE::localtime_s(&t_ptr, &input);
104104
ASSERT_EQ(-1, result);
105105

0 commit comments

Comments
 (0)