Skip to content

Commit 01c3167

Browse files
committed
add implementation for localtime_r for baremetal
1 parent 68d334a commit 01c3167

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation of localtime_r for baremetal -----------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "src/time/localtime_r.h"
10+
11+
namespace LIBC_NAMESPACE_DECL {
12+
13+
LLVM_LIBC_FUNCTION(struct tm *, localtime_r,
14+
(const time_t *timer, struct tm *buf)) {
15+
if (timer == nullptr) {
16+
return nullptr;
17+
}
18+
19+
return time_utils::localtime_internal(timer, buf);
20+
}
21+
22+
} // namespace LIBC_NAMESPACE_DECL

0 commit comments

Comments
 (0)