Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Standard library header <time.h>

      From cppreference.com
      <c‎ |header
       
       
       

      This header is part ofdate and time utilities library.

      Contents

      [edit]Functions

      Time manipulation
      computes the difference between times
      (function)[edit]
      returns the current calendar time of the system as time since epoch
      (function)[edit]
      returns raw processor clock time since the program is started
      (function)[edit]
      returns the calendar time in seconds and nanoseconds based on a given time base
      (function)[edit]
      returns the resolution of calendar time based on a given time base
      (function)[edit]
      Format conversions
      (deprecated in C23)(C11)
      converts atm object to a textual representation
      (function)[edit]
      (deprecated in C23)(C11)
      converts atime_t object to a textual representation
      (function)[edit]
      converts atm object to custom textual representation
      (function)[edit]
      converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC)
      (function)[edit]
      converts time since epoch to calendar time expressed as local time
      (function)[edit]
      converts calendar time to time since epoch
      (function)[edit]

      [edit]Constants

      number of processor clock ticks per second
      (macro constant)[edit]

      [edit]Types

      calendar time type
      (struct)[edit]
      calendar time since epoch type
      (typedef)[edit]
      processor time since era type
      (typedef)[edit]
      time in seconds and nanoseconds
      (struct)[edit]

      [edit]Synopsis

      #define __STDC_VERSION_TIME_H__ 202311L #define NULL           /* see description */#define CLOCKS_PER_SEC /* see description */#define TIME_UTC       /* see description */ typedef/* see description */clock_t;typedef/* see description */size_t;typedef/* see description */time_t; struct timespec{/* see description */};structtm{/* see description */}; clock_tclock(void);doubledifftime(time_t time1,time_t time0);time_tmktime(structtm* timeptr);time_t timegm(structtm* timeptr);time_ttime(time_t* timer);int timespec_get(struct timespec* ts,int base);int timespec_getres(struct timespec* ts,int base);[[deprecated]]char*asctime(conststructtm* timeptr);[[deprecated]]char*ctime(consttime_t* timer);structtm*gmtime(consttime_t* timer);structtm* gmtime_r(consttime_t* timer,structtm* buf);structtm*localtime(consttime_t* timer);structtm* localtime_r(consttime_t* timer,structtm* buf);size_tstrftime(char*restrict s,size_t maxsize,constchar*restrict format,conststructtm*restrict timeptr);

      Only if supported by the implementation:

      #define TIME_MONOTONIC /* see description */#define TIME_ACTIVE    /* see description */

      Only if threads are supported and it is supported by the implementation:

      #define TIME_THREAD_ACTIVE /* see description */

      Only if the implementation defines__STDC_LIB_EXT1__ and additionally the user code defines__STDC_WANT_LIB_EXT1__ before any inclusion of<time.h>:

      #ifdef __STDC_WANT_LIB_EXT1__typedef/* see description */ errno_t;typedef/* see description */ rsize_t; errno_t asctime_s(char* s, rsize_t maxsize,conststructtm* timeptr);errno_t ctime_s(char* s, rsize_t maxsize,consttime_t* timer);structtm* gmtime_s(consttime_t*restrict timer,structtm*restrict result);structtm* localtime_s(consttime_t*restrict timer,structtm*restrict result);#endif
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/header/time&oldid=180743"

      [8]ページ先頭

      ©2009-2025 Movatter.jp