You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Converts a **`time_t`** time value to a **`tm`** structure, and corrects for the local time zone. These are versions of [`localtime`, `_localtime32`, `_localtime64`](localtime-localtime32-localtime64.md) with security enhancements as described in [Security features in the CRT](../security-features-in-the-crt.md).
15
+
Converts a **`time_t`** time value to a **`tm`** structure, and corrects for the local time zone. These functions are versions of [`localtime`, `_localtime32`, `_localtime64`](localtime-localtime32-localtime64.md) with security enhancements as described in [Security features in the CRT](../security-features-in-the-crt.md).
16
16
17
17
## Syntax
18
18
@@ -41,7 +41,7 @@ Pointer to the stored time.
41
41
42
42
## Return value
43
43
44
-
Zero if successful. The return value is an error code if there is a failure. Error codes are defined in *`Errno.h`*. For a listing of these errors, see [`errno`](../errno-doserrno-sys-errlist-and-sys-nerr.md).
44
+
Zero if successful. The return value is an error code if there's a failure. Error codes are defined in *`Errno.h`*. For a listing of these errors, see [`errno`](../errno-doserrno-sys-errlist-and-sys-nerr.md).
45
45
46
46
### Error conditions
47
47
@@ -51,20 +51,20 @@ Zero if successful. The return value is an error code if there is a failure. Err
51
51
|Not `NULL` (points to valid memory)|`NULL`|`EINVAL`|All fields set to -1|Yes|
52
52
|Not `NULL` (points to valid memory)|less than 0 or greater than `_MAX__TIME64_T`|`EINVAL`|All fields set to -1|No|
53
53
54
-
In the case of the first two error conditions, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, these functions set `errno` to `EINVAL` and return `EINVAL`.
54
+
The first two error conditions invoke the invalid parameter handler, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, these functions set `errno` to `EINVAL` and return `EINVAL`.
55
55
56
56
## Remarks
57
57
58
-
The **`localtime_s`** function converts a time stored as a [`time_t`](../standard-types.md) value and stores the result in a structure of type [`tm`](../standard-types.md). The **`time_t`** value *`sourceTime`* represents the seconds elapsed since midnight (00:00:00), January 1, 1970, UTC. This value is usually obtained from the [`time`](time-time32-time64.md) function.
58
+
The **`localtime_s`** function converts a time stored as a [`time_t`](../standard-types.md) value and stores the result in a structure of type [`tm`](../standard-types.md). The **`time_t`** value *`sourceTime`* represents the seconds elapsed since midnight (00:00:00), January 1, 1970, UTC. This value is often obtained from the [`time`](time-time32-time64.md) function.
59
59
60
-
**`localtime_s`** corrects for the local time zone if the user first sets the global environment variable **`TZ`**. When **`TZ`** is set, three other environment variables (**`_timezone`**, **`_daylight`**, and **`_tzname`**) are automatically set as well. If the **`TZ`** variable is not set, **`localtime_s`** attempts to use the time zone information specified in the Date/Time application in Control Panel. If this information cannot be obtained, PST8PDT, which signifies the Pacific time zone, is used by default. See [`_tzset`](tzset.md) for a description of these variables. **`TZ`** is a Microsoft extension and not part of the ANSI standard definition of **`localtime`**.
60
+
**`localtime_s`** corrects for the local time zone if the user first sets the global environment variable **`TZ`**. When **`TZ`** is set, three other environment variables (**`_timezone`**, **`_daylight`**, and **`_tzname`**) are automatically set as well. If the **`TZ`** variable isn't set, **`localtime_s`** attempts to use the time zone information specified in the Date/Time application in Control Panel. If this information can't be obtained, PST8PDT, which signifies the Pacific time zone, is used by default. See [`_tzset`](tzset.md) for a description of these variables. **`TZ`** is a Microsoft extension and not part of the ANSI standard definition of **`localtime`**.
61
61
62
62
> [!NOTE]
63
63
> The target environment should try to determine whether daylight saving time is in effect.
64
64
65
65
**`_localtime64_s`**, which uses the **`__time64_t`** structure, allows dates to be expressed up through 23:59:59, January 18, 3001, coordinated universal time (UTC), whereas **`_localtime32_s`** represents dates through 23:59:59 January 18, 2038, UTC.
66
66
67
-
**`localtime_s`** is an inline function which evaluates to **`_localtime64_s`**, and **`time_t`** is equivalent to **`__time64_t`**. If you need to force the compiler to interpret **`time_t`** as the old 32-bit **`time_t`**, you can define `_USE_32BIT_TIME_T`. Doing this will cause **`localtime_s`** to evaluate to **`_localtime32_s`**. This is not recommended because your application may fail after January 18, 2038, and it is not allowed on 64-bit platforms.
67
+
**`localtime_s`** is an inline function that evaluates to **`_localtime64_s`**, and **`time_t`** is equivalent to **`__time64_t`**. If you need to force the compiler to interpret **`time_t`** as the old 32-bit **`time_t`**, you can define `_USE_32BIT_TIME_T`, which causes **`localtime_s`** to evaluate to **`_localtime32_s`**. We don't recommend `_USE_32BIT_TIME_T`, because your application may fail after January 18, 2038, and it isn't allowed on 64-bit platforms.
68
68
69
69
The fields of the structure type [`tm`](../standard-types.md) store the following values, each of which is an **`int`**.
70
70
@@ -78,7 +78,7 @@ The fields of the structure type [`tm`](../standard-types.md) store the followin
78
78
|**`tm_year`**|Year (current year minus 1900).|
79
79
|**`tm_wday`**|Day of week (0 - 6; Sunday = 0).|
80
80
|**`tm_yday`**|Day of year (0 - 365; January 1 = 0).|
81
-
|**`tm_isdst`**|Positive value if daylight saving time is in effect; 0 if daylight saving time is not in effect; negative value if status of daylight saving time is unknown.|
81
+
|**`tm_isdst`**|Positive value if daylight saving time is in effect; 0 if daylight saving time isn't in effect; negative value if status of daylight saving time is unknown.|
82
82
83
83
If the **`TZ`** environment variable is set, the C run-time library assumes rules appropriate to the United States for implementing the calculation of daylight saving time (DST).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/lock-file.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ File handle.
27
27
28
28
## Remarks
29
29
30
-
The **`_lock_file`** function locks the `FILE` object specified by *`file`*. The underlying file is not locked by **`_lock_file`**. Use [`_unlock_file`](unlock-file.md) to release the lock on the file. Calls to **`_lock_file`** and **`_unlock_file`** must be matched in a thread.
30
+
The **`_lock_file`** function locks the `FILE` object specified by *`file`*. The underlying file isn't locked by **`_lock_file`**. Use [`_unlock_file`](unlock-file.md) to release the lock on the file. Calls to **`_lock_file`** and **`_unlock_file`** must be matched in a thread.
31
31
32
32
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).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/locking.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -43,26 +43,26 @@ Number of bytes to lock.
43
43
|-|-|
44
44
|`EACCES`| Locking violation (file already locked or unlocked). |
45
45
|`EBADF`| Invalid file descriptor. |
46
-
|`EDEADLOCK`| Locking violation. Returned when the `_LK_LOCK` or `_LK_RLCK` flag is specified and the file cannot be locked after 10 attempts. |
46
+
|`EDEADLOCK`| Locking violation. Returned when the `_LK_LOCK` or `_LK_RLCK` flag is specified and the file can't be locked after 10 attempts. |
47
47
|`EINVAL`| An invalid argument was given to **`_locking`**. |
48
48
49
49
If the failure is due to a bad parameter, such as an invalid file descriptor, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md).
50
50
51
51
## Remarks
52
52
53
-
The **`_locking`** function locks or unlocks *`nbytes`* bytes of the file specified by *`fd`*. Locking bytes in a file prevents access to those bytes by other processes. All locking or unlocking begins at the current position of the file pointer and proceeds for the next *`nbytes`* bytes. It is possible to lock bytes past end of file.
53
+
The **`_locking`** function locks or unlocks *`nbytes`* bytes of the file specified by *`fd`*. Locking bytes in a file prevents access to those bytes by other processes. All locking or unlocking begins at the current position of the file pointer and proceeds for the next *`nbytes`* bytes. It's possible to lock bytes past end of file.
54
54
55
55
*`mode`* must be one of the following manifest constants, which are defined in Locking.h.
56
56
57
57
|*`mode`* value|Effect|
58
58
|-|-|
59
-
|`_LK_LOCK`| Locks the specified bytes. If the bytes cannot be locked, the program immediately tries again after 1 second. If, after 10 attempts, the bytes cannot be locked, the constant returns an error. |
60
-
|`_LK_NBLCK`| Locks the specified bytes. If the bytes cannot be locked, the constant returns an error. |
59
+
|`_LK_LOCK`| Locks the specified bytes. If the bytes can't be locked, the program immediately tries again after 1 second. Ifthe bytes can't be locked after 10 attempts, the constant returns an error. |
60
+
|`_LK_NBLCK`| Locks the specified bytes. If the bytes can't be locked, the constant returns an error. |
61
61
|`_LK_NBRLCK`| Same as `_LK_NBLCK`. |
62
62
|`_LK_RLCK`| Same as `_LK_LOCK`. |
63
63
|`_LK_UNLCK`| Unlocks the specified bytes, which must have been previously locked. |
64
64
65
-
Multiple regions of a file that do not overlap can be locked. A region being unlocked must have been previously locked. **`_locking`**does not merge adjacent regions; if two locked regions are adjacent, each region must be unlocked separately. Regions should be locked only briefly and should be unlocked before closing a file or exiting the program.
65
+
Multiple regions of a file that don't overlap can be locked. A region being unlocked must have been previously locked. **`_locking`**doesn't merge adjacent regions; if two locked regions are adjacent, each region must be unlocked separately. Regions should be locked only briefly and should be unlocked before closing a file or exiting the program.
66
66
67
67
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).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/log-logf-log10-log10f.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,9 @@ Value whose logarithm is to be found.
40
40
41
41
The **`log`** functions return the natural logarithm (base *`e`*) of *`x`* if successful. The **`log10`** functions return the base-10 logarithm. If *`x`* is negative, these functions return an indefinite (`IND`), by default. If *`x`* is 0, they return infinity (`INF`).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/longjmp.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -33,25 +33,25 @@ Value to be returned to `setjmp` call.
33
33
34
34
## Remarks
35
35
36
-
The **`longjmp`** function restores a stack environment and execution locale previously saved in *`env`* by `setjmp`. `setjmp` and **`longjmp`** provide a way to execute a nonlocal **`goto`**; they are typically used to pass execution control to error-handling or recovery code in a previously called routine without using the normal call and return conventions.
36
+
The **`longjmp`** function restores a stack environment and execution locale previously saved in *`env`* by `setjmp`. `setjmp` and **`longjmp`** provide a way to execute a nonlocal **`goto`**; they're typically used to pass execution control to error-handling or recovery code in a previously called routine without using the normal call and return conventions.
37
37
38
-
A call to `setjmp` causes the current stack environment to be saved in *`env`*. A subsequent call to **`longjmp`** restores the saved environment and returns control to the point immediately following the corresponding `setjmp` call. Execution resumes as if *`value`* had just been returned by the `setjmp` call. The values of all variables (except register variables) that are accessible to the routine receiving control contain the values they had when **`longjmp`** was called. The values of register variables are unpredictable. The value returned by `setjmp` must be nonzero. If *`value`* is passed as 0, the value 1 is substituted in the actual return.
38
+
A call to `setjmp` causes the current stack environment to be saved in *`env`*. A subsequent call to **`longjmp`** restores the saved environment and returns control to the point immediately following the corresponding `setjmp` call. Execution resumes as if *`value`* had been returned by the `setjmp` call. The values of all variables (except register variables) that are accessible to the routine receiving control contain the values they had when **`longjmp`** was called. The values of register variables are unpredictable. The value returned by `setjmp` must be nonzero. If *`value`* is passed as 0, the value 1 is substituted in the actual return.
39
39
40
40
**Microsoft Specific**
41
41
42
-
In Microsoft C++ code on Windows, **`longjmp`** uses the same stack-unwinding semantics as exception-handling code. It is safe to use in the same places that C++ exceptions can be raised. However, this usage is not portable, and comes with some important caveats.
42
+
In Microsoft C++ code on Windows, **`longjmp`** uses the same stack-unwinding semantics as exception-handling code. It's safe to use in the same places that C++ exceptions can be raised. However, this usage isn't portable, and comes with some important caveats.
43
43
44
44
Only call **`longjmp`** before the function that called `setjmp` returns; otherwise the results are unpredictable.
45
45
46
46
Observe the following restrictions when using **`longjmp`**:
47
47
48
-
-Do not assume that the values of the register variables will remain the same. The values of register variables in the routine calling `setjmp` may not be restored to the proper values after **`longjmp`** is executed.
48
+
-Don't assume that the values of the register variables will remain the same. The values of register variables in the routine calling `setjmp` may not be restored to the proper values after **`longjmp`** is executed.
49
49
50
-
-Do not use **`longjmp`** to transfer control out of an interrupt-handling routine unless the interrupt is caused by a floating-point exception. In this case, a program may return from an interrupt handler via **`longjmp`** if it first reinitializes the floating-point math package by calling [`_fpreset`](fpreset.md).
50
+
-Don't use **`longjmp`** to transfer control out of an interrupt-handling routine unless the interrupt is caused by a floating-point exception. In this case, a program may return from an interrupt handler via **`longjmp`** if it first reinitializes the floating-point math package by calling [`_fpreset`](fpreset.md).
51
51
52
-
-Do not use **`longjmp`** to transfer control from a callback routine invoked directly or indirectly by Windows code.
52
+
-Don't use **`longjmp`** to transfer control from a callback routine invoked directly or indirectly by Windows code.
53
53
54
-
- If the code is compiled by using **/EHs** or **/EHsc** and the function that contains the **`longjmp`** call is **`noexcept`** then local objects in that function may not be destructed during the stack unwind.
54
+
- If the code is compiled by using **/EHs** or **/EHsc**, and the function that contains the **`longjmp`** call is **`noexcept`**, then local objects in that function may not be destructed during the stack unwind.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/lrint-lrintf-lrintl-llrint-llrintf-llrintl.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ Because C++ allows overloading, you can call overloads of **`lrint`** and **`llr
79
79
80
80
If you use the \<tgmath.h> `llrint()` macro, the type of the argument determines which version of the function is selected. See [Type-generic math](../tgmath.md) for details.
81
81
82
-
If *`x`* does not represent the floating-point equivalent of an integral value, these functions raise `FE_INEXACT`.
82
+
If *`x`* doesn't represent the floating-point equivalent of an integral value, these functions raise `FE_INEXACT`.
83
83
84
84
**Microsoft-specific**: When the result is outside the range of the return type, or when the parameter is a NaN or infinity, the return value is implementation defined. The Microsoft compiler returns a zero (0) value.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/lround-lroundf-lroundl-llround-llroundf-llroundl.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -59,13 +59,13 @@ The floating-point value to round.
59
59
60
60
The **`lround`** and **`llround`** functions return the nearest **`long`** or **`long long`** integer to *`x`*. Halfway values are rounded away from zero, regardless of the setting of the floating-point rounding mode. There's no error return.
Because C++ allows overloading, you can call overloads of **`lround`** or **`llround`** that take and return **`float`** and **`long double`** values. In a C program, unless you're using the \<tgmath.h> macro to call this function, **`lround`** and **`llround`** always take and return a **`double`**.
68
+
Because C++ allows overloading, you can call **`lround`** or **`llround`** overloads that take and return **`float`** and **`long double`** values. In a C program, unless you're using the \<tgmath.h> macro to call this function, **`lround`** and **`llround`** always take and return a **`double`**.
69
69
70
70
If you use the \<tgmath.h> `lround()` macro, the type of the argument determines which version of the function is selected. See [Type-generic math](../tgmath.md) for details.
0 commit comments