|
1 | 1 | --- |
2 | 2 | description: "Learn more about: asctime, _wasctime" |
3 | 3 | title: "asctime, _wasctime" |
4 | | -ms.date: "4/2/2020" |
| 4 | +ms.date: 12/21/2022 |
5 | 5 | api_name: ["_wasctime", "asctime", "_o__wasctime", "_o_asctime"] |
6 | 6 | api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-time-l1-1-0.dll"] |
7 | 7 | api_type: ["DLLExport"] |
@@ -52,32 +52,32 @@ The **`asctime`** function converts a time stored as a structure to a character |
52 | 52 | | `tm_yday` | Day of year (0-365; January 1 = 0) | |
53 | 53 | | `tm_year` | Year (current year minus 1900) | |
54 | 54 |
|
55 | | -The converted character string is also adjusted according to the local time zone settings. For information about configuring the local time, see the [`time`](time-time32-time64.md), [`_ftime`](ftime-ftime32-ftime64.md), and [`localtime`](localtime-localtime32-localtime64.md) functions. For information about defining the time zone environment and global variables, see the [`_tzset`](tzset.md) function. |
| 55 | +For information about configuring the local time, see the [`time`](time-time32-time64.md), [`_ftime`](ftime-ftime32-ftime64.md), and [`localtime`](localtime-localtime32-localtime64.md) functions. For information about defining the time zone environment and global variables, see the [`_tzset`](tzset.md) function. |
56 | 56 |
|
57 | 57 | The string result produced by **`asctime`** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **`asctime`** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call. |
58 | 58 |
|
59 | | -**`_wasctime`** is a wide-character version of **`asctime`**. **`_wasctime`** and **`asctime`** behave identically otherwise. |
| 59 | +**`_wasctime`** is a wide-character version of **`asctime`**, and otherwise behaves identically to **`asctime`**. |
60 | 60 |
|
61 | 61 | These functions validate their parameters. If *`timeptr`* is a null pointer, or if it contains out-of-range values, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, the function returns `NULL` and sets `errno` to `EINVAL`. |
62 | 62 |
|
63 | 63 | By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md). |
64 | 64 |
|
65 | 65 | ### Generic-text routine mapping |
66 | 66 |
|
67 | | -| TCHAR.H routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined | |
| 67 | +| `TCHAR.H` routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined | |
68 | 68 | |---|---|---|---| |
69 | 69 | | `_tasctime` | **`asctime`** | **`asctime`** | **`_wasctime`** | |
70 | 70 |
|
71 | 71 | ## Requirements |
72 | 72 |
|
73 | 73 | | Routine | Required header | |
74 | 74 | |---|---| |
75 | | -| **`asctime`** | \<time.h> | |
76 | | -| **`_wasctime`** | \<time.h> or \<wchar.h> | |
| 75 | +| **`asctime`** | `<time.h>` | |
| 76 | +| **`_wasctime`** | `<time.h>` or `<wchar.h>` | |
77 | 77 |
|
78 | 78 | ## Example |
79 | 79 |
|
80 | | -This program places the system time in the long integer `aclock`, translates it into the structure `newtime` and then converts it to string form for output, using the **`asctime`** function. |
| 80 | +This program places the system time in the long integer `aclock`, translates it into the structure `newtime`, and then converts it to string form for output using the **`asctime`** function. |
81 | 81 |
|
82 | 82 | ```C |
83 | 83 | // crt_asctime.c |
|
0 commit comments