Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::chrono::system_clock

      From cppreference.com
      <cpp‎ |chrono
       
       
      Date and time library
      Time point
      (C++11)
      (C++20)
      Duration
      (C++11)
      Clocks
      system_clock
      (C++11)
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      (C++20)
      Time of day
      (C++20)(C++20)
      (C++20)(C++20)
      (C++20)
       
       
      Defined in header<chrono>
      class system_clock;
      (since C++11)

      Classstd::chrono::system_clock represents the system-wide real time wall clock.

      It may not be monotonic: on most systems, the system time can be adjusted at any moment. It is the only C++ clock that has the ability to map its time points to C-style time.

      std::chrono::system_clock meets the requirements ofTrivialClock.

      The epoch ofsystem_clock is unspecified, but most implementations use Unix Time (i.e., time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds).

      (until C++20)

      system_clock measures Unix Time (i.e., time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds).

      (since C++20)

      Contents

      Time point family

      Defined in namespacestd::chrono
      template<class Duration>
      using sys_time=std::chrono::time_point<std::chrono::system_clock, Duration>;
      (since C++20)
      using sys_seconds= sys_time<std::chrono::seconds>;
      (since C++20)
      using sys_days= sys_time<std::chrono::days>;
      (since C++20)
      performs stream output on asys_time
      (function template)[edit]
      parses asys_time from a stream according to the provided format
      (function template)[edit]
      formatting support forsys_time
      (class template specialization)[edit]

      [edit]Member types

      Member type Definition
      rep signed arithmetic type representing the number of ticks in the clock's duration
      period astd::ratio type representing the tick period of the clock, in seconds
      durationstd::chrono::duration<rep, period>, capable of representing negative durations
      time_pointstd::chrono::time_point<std::chrono::system_clock>

      [edit]Member constants

      constexpr bool is_steady
      [static]
      true if the time between ticks is always constant, i.e. calls tonow() return values that increase monotonically even in case of some external clock adjustment, otherwisefalse
      (public static member constant)

      [edit]Member functions

      [static]
      returns astd::chrono::time_point representing the current point in time
      (public static member function)[edit]
      [static]
      converts a system clock time point tostd::time_t
      (public static member function)[edit]
      [static]
      convertsstd::time_t to a system clock time point
      (public static member function)[edit]

      [edit]Notes

      Thesystem_clock's time value can be internally adjusted at any time by the operating system, for example due to NTP synchronization or the user changing the system's clock. Daylight Saving Time and time zone changes, however, do not affect it since it is based on theUTC time-zone.

      [edit]See also

      monotonic clock that will never be adjusted
      (class)[edit]
      the clock with the shortest tick period available
      (class)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/system_clock&oldid=154231"

      [8]ページ先頭

      ©2009-2025 Movatter.jp