Scroll Down to See All
abortabsacosasctimeasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : asctime_r

char *asctime_r(const struct tm * timeptr,char * buffer) ;

Return Type : char *

String pointer (array of characters)
Read about return values of asctime_r function .

1st Parameter Type : const struct tm *

Pointer to a constant `struct tm`, which represents broken-down time values including year, month, day, hour, minute, and second.

1st Parameter

Pointer to a `struct tm` representing broken-down time

2nd Parameter Type : char *

String pointer (array of characters)

2nd Parameter

Pointer to a user-supplied buffer to store the resulting string

Read more about parameters of asctime_r in parameters section
The asctime_rfunction in C language Thread-safe version of asctime.
The asctime_r function is a thread-safe version of asctime. It converts a time structure (struct tm) to a string representation and stores the result in a user-provided buffer. This function is reentrant and can be used safely in multi-threaded programs. The resulting string has the form 'Day Mon dd hh:mm:ss yyyy\n'.
The asctime_rfunction takes 2 parameters:
  • const struct tm * `timeptr`: Pointer to a `struct tm` representing broken-down time
  • char * `buffer`: Pointer to a user-supplied buffer to store the resulting string

8 3 5


The asctime_r function return value :
  • Returns a pointer to the string result if successful, or NULL if an error occurred

Output

This example demonstrates the basic usage of the `asctime_r` function to convert the current local time to a string representation in a thread-safe manner.