Instant.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
  3. * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
  4. * Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
  5. * Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
  6. *
  7. * SPDX-License-Identifier: BSD-2-Clause
  8. */
  9. #include <LibJS/Runtime/Temporal/Instant.h>
  10. namespace JS::Temporal {
  11. // nsMaxInstant = 10**8 × nsPerDay = 8.64 × 10**21
  12. Crypto::SignedBigInteger const NANOSECONDS_MAX_INSTANT = "8640000000000000000000"_sbigint;
  13. // nsMinInstant = -nsMaxInstant = -8.64 × 10**21
  14. Crypto::SignedBigInteger const NANOSECONDS_MIN_INSTANT = "-8640000000000000000000"_sbigint;
  15. // nsPerDay = 10**6 × ℝ(msPerDay) = 8.64 × 10**13
  16. Crypto::UnsignedBigInteger const NANOSECONDS_PER_DAY = 86400000000000_bigint;
  17. // Non-standard:
  18. Crypto::UnsignedBigInteger const NANOSECONDS_PER_HOUR = 3600000000000_bigint;
  19. Crypto::UnsignedBigInteger const NANOSECONDS_PER_MINUTE = 60000000000_bigint;
  20. Crypto::UnsignedBigInteger const NANOSECONDS_PER_SECOND = 1000000000_bigint;
  21. Crypto::UnsignedBigInteger const NANOSECONDS_PER_MILLISECOND = 1000000_bigint;
  22. Crypto::UnsignedBigInteger const NANOSECONDS_PER_MICROSECOND = 1000_bigint;
  23. Crypto::UnsignedBigInteger const NANOSECONDS_PER_NANOSECOND = 1_bigint;
  24. Crypto::UnsignedBigInteger const MICROSECONDS_PER_MILLISECOND = 1000_bigint;
  25. Crypto::UnsignedBigInteger const MILLISECONDS_PER_SECOND = 1000_bigint;
  26. Crypto::UnsignedBigInteger const SECONDS_PER_MINUTE = 60_bigint;
  27. Crypto::UnsignedBigInteger const MINUTES_PER_HOUR = 60_bigint;
  28. Crypto::UnsignedBigInteger const HOURS_PER_DAY = 24_bigint;
  29. }