Skip to content

[libc] fix 32bit arm build (casting time_t) #92065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2024

Conversation

SchrodingerZhu
Copy link
Contributor

No description provided.

@SchrodingerZhu SchrodingerZhu requested a review from lntue May 14, 2024 04:44
@llvmbot llvmbot added the libc label May 14, 2024
@llvmbot
Copy link
Member

llvmbot commented May 14, 2024

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/92065.diff

1 Files Affected:

  • (modified) libc/src/__support/time/units.h (+6-6)
diff --git a/libc/src/__support/time/units.h b/libc/src/__support/time/units.h
index f6bd19f9b1396..ee74af70efdfc 100644
--- a/libc/src/__support/time/units.h
+++ b/libc/src/__support/time/units.h
@@ -15,22 +15,22 @@
 namespace LIBC_NAMESPACE {
 namespace time_units {
 LIBC_INLINE constexpr time_t operator""_s_ns(unsigned long long s) {
-  return s * 1'000'000'000;
+  return static_cast<time_t>(s * 1'000'000'000);
 }
 LIBC_INLINE constexpr time_t operator""_s_us(unsigned long long s) {
-  return s * 1'000'000;
+  return static_cast<time_t>(s * 1'000'000);
 }
 LIBC_INLINE constexpr time_t operator""_s_ms(unsigned long long s) {
-  return s * 1'000;
+  return static_cast<time_t>(s * 1'000);
 }
 LIBC_INLINE constexpr time_t operator""_ms_ns(unsigned long long ms) {
-  return ms * 1'000'000;
+  return static_cast<time_t>(ms * 1'000'000);
 }
 LIBC_INLINE constexpr time_t operator""_ms_us(unsigned long long ms) {
-  return ms * 1'000;
+  return static_cast<time_t>(ms * 1'000);
 }
 LIBC_INLINE constexpr time_t operator""_us_ns(unsigned long long us) {
-  return us * 1'000;
+  return static_cast<time_t>(us * 1'000);
 }
 } // namespace time_units
 } // namespace LIBC_NAMESPACE

@SchrodingerZhu SchrodingerZhu changed the title [libc] fix 32bit debian build (casting time_t) [libc] fix 32bit arm build (casting time_t) May 14, 2024
@SchrodingerZhu SchrodingerZhu merged commit 96c23af into llvm:main May 14, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants