Enhance localtime_s documentation on compatibility#5918
Enhance localtime_s documentation on compatibility#5918Pawwz85 wants to merge 2 commits intoMicrosoftDocs:mainfrom
Conversation
Clarified compatibility issues of localtime_s with C standard and provided guidance for enabling the standard-conforming variant.
|
@Pawwz85 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit edc9a11: ✅ Validation status: passed
For more details, please refer to the build report. |
|
Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
TylerMSFT
left a comment
There was a problem hiding this comment.
Can we modify this slightly. As written, someone might think the behavior is different.
Something like: The Microsoft-specific localtime_s has a different signature than the C standard version. To enable the standard-conforming variant, define _CRT_USE_CONFORMING_ANNEX_K_TIME to a nonzero value before including <time.h>.
|
@TylerMSFT Thanks for reviewing my pull request and providing feedback. I added clarification you suggested and decided to sneak in simillar remark for gmtime_s since _CRT_USE_CONFORMING_ANNEX_K_TIME touches it too. |
|
Learn Build status updates of commit 3ddbd60: ✅ Validation status: passed
For more details, please refer to the build report. |
|
@microsoft-github-policy-service agree |
TylerMSFT
left a comment
There was a problem hiding this comment.
Small tweak. Thank you for catching the other one as well.
| > The target environment should try to determine whether daylight saving time is in effect. | ||
|
|
||
| The Microsoft-specific **`localtime_s`** has a different signature than the C standard version. To enable the standard-conforming variant, define **`_CRT_USE_CONFORMING_ANNEX_K_TIME`** to a nonzero value before including any of the required headers. | ||
|
|
There was a problem hiding this comment.
"any of the required headers" is so vague that we may as well not say anything. Since it's only defined in <time.h>, let's call out which one we are talking about. Yes, there could be other headers that pull in <time.h>, but since that's the one that matters, let's call it out.
|
|
||
| **`_gmtime64_s`**, which uses the **`__time64_t`** structure, allows dates to be expressed up through 23:59:59, December 31, 3000, UTC; whereas **`gmtime32_s`** only represent dates through 23:59:59 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for both these functions. | ||
|
|
||
| The Microsoft-specific **`gmtime_s`** has a different signature than the C standard version. To enable the standard-conforming variant, define **`_CRT_USE_CONFORMING_ANNEX_K_TIME`** to a nonzero value before including any of the required headers. |
There was a problem hiding this comment.
"any of the required headers" is so vague that we may as well not say anything. Since it's only defined in <time.h>, let's call out which one we are talking about. Yes, there could be other headers that pull in <time.h>, but since that's the one that matters, let's call it out.
|
@Pawwz85 Can you respond to the requested changes or let us know if you would like us to commit them? @TylerMSFT - When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
Clarified compatibility issues of localtime_s with C standard and provided guidance for enabling the standard-conforming variant.