<p>libcs are implementing changes to fix the year 2038 issue on 32 bit<br>
platforms (see [1]). musl libc already went ahead and implemented it,<br>
starting with musl-1.2.0 (see [2]).</p>
<p>This commit adds a new definition to src/core/dprint.h:</p>
<p>TIME_T_INT_FMT</p>
<p>If __USE_TIME_BITS64 is defined (by a time64 libc, see [1]), it is set<br>
to the proper conversion for type int64_t, PRId64.  If __USE_TIME_BITS64<br>
is not defined, the status quo remains unchanged ("%ld" is used).</p>
<p>Note: In some places kamailio uses "%li" instead of "%ld". But in the<br>
context of printf etc. there is no difference, so this commit replaces<br>
"%li" with "%ld".</p>
<p>The new definition is used in the different parts of kamailio, where<br>
appropriate.</p>
<p>These changes get rid of the new warnings that appeared with musl-1.2.0.<br>
Below an example warning:</p>
<p>In file included from auth_identity.c:50:<br>
auth_identity.c: In function 'check_date':<br>
../../core/dprint.h:316:73: warning: format '%ld' expects argument of type 'long int', but argument 11 has type 'time_t' {aka 'long long int'} [-Wformat=]<br>
316 |                                                         fprintf(stderr, "%2d(%d) %s: %.*s%s%s%s" fmt, <br>
|                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~<br>
../../core/dprint.h:340:25: note: in expansion of macro 'LOG_FX'<br>
340 |                         LOG_FX(facility, level, lname, prefix, <em>FUNC_NAME</em>, fmt, ## args)<br>
|                         ^~~~~~<br>
../../core/dprint.h:346:25: note: in expansion of macro 'LOG_FL'<br>
346 |                         LOG_FL(facility, level, NULL, prefix, fmt, ## args)<br>
|                         ^~~~~~<br>
../../core/dprint.h:349:25: note: in expansion of macro 'LOG_FP'<br>
349 |                         LOG_FP(DEFAULT_FACILITY, (level), LOC_INFO, fmt, ## args)<br>
|                         ^~~~~~<br>
auth_identity.c:594:17: note: in expansion of macro 'LOG'<br>
594 |                 LOG(L_INFO, "AUTH_IDENTITY VERIFIER: Outdated date header value (%ld sec)\n", tnow - tmsg + glb_iauthval);<br>
|                 ^~~</p>
<p>[1] <a rel="nofollow" href="https://sourceware.org/glibc/wiki/Y2038ProofnessDesign">https://sourceware.org/glibc/wiki/Y2038ProofnessDesign</a><br>
[2] <a rel="nofollow" href="https://musl.libc.org/time64.html">https://musl.libc.org/time64.html</a></p>
<p>Signed-off-by: Sebastian Kemper <a href="mailto:sebastian_ml@gmx.net">sebastian_ml@gmx.net</a></p>


<h4>Pre-Submission Checklist</h4>



<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commit message has the format required by CONTRIBUTING guide</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commits are split per component (core, individual modules, libs, utils, ...)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Each component has a single commit (if not, squash them into one commit)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> No commits to README files for modules (changes must be done to docbook files<br>
in <code>doc/</code> subfolder, the README file is autogenerated)</li>
</ul>
<h4>Type Of Change</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Small bug fix (non-breaking change which fixes an issue)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> New feature (non-breaking change which adds new functionality)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Breaking change (fix or feature that would change existing functionality)</li>
</ul>
<h4>Checklist:</h4>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> PR should be backported to stable branches</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Tested changes locally</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Related to issue #XXXX (replace XXXX with an open issue number)</li>
</ul>
<h4>Description</h4>

<p>Hi all,</p>
<p>This adds time64 libc support. Should be non-breaking, status quo remains. I hope you don't mind a made up a new patch category, "time".</p>
<p>I did not run-test this (pretty busy right now). But the warnings go away.</p>
<p>If absolutely run-testing is needed for this, let me know.</p>
<p>Kind regards,<br>
Seb</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/2894'>https://github.com/kamailio/kamailio/pull/2894</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/kamailio/kamailio/pull/2894/commits/27175614787f6b05795f1e019e7d17df32d19be6">time: add support for time64 libc</a></li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-07ba1468fdf20b7cca0842497dfeaf750eeca0c27e20f8cfa2d204f538b93464">src/core/dprint.h</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-e57262860b0040ba6121b1e7ef0086d96ca5ee06b63aaabd99a4aa8aea6d30db">src/modules/auth_identity/auth_identity.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-4637437d83dad08a48d2bdbdd8efcdca0e909246d0fcb0742da66de9e1b43149">src/modules/cdp/routing.c</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-adb5ccf473fd4b890b999b17e54a80a46401b219a95684a45f8999f25a7900cd">src/modules/db_redis/redis_dbase.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-7cd7b3b53c89f36d9c7fa1172243ffcbe2fb6a3b4165dba1d51bbe9ebe73b546">src/modules/ims_charging/ims_ro.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-cc9b0d94b713fd9f37f1497084404601a00092b27f51ba6ddd7209586578e64e">src/modules/ims_dialog/dlg_handlers.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-4f2e663d29dc5765421f4e1eb2dfeb47e440ba70c8d14aeadbe29b66c7c55064">src/modules/ims_icscf/scscf_list.c</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-926a04f55fef84dd254f9a06e9cf12ad9811d9e550c3dab9d66db207b849b3ec">src/modules/ims_registrar_pcscf/notify.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-db0b0996a57771ddcccd14789eeb4ff956734135a00172604aff37292a797920">src/modules/ims_registrar_pcscf/save.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-7a8553a0faf0afeb5fc651799ac38e57ed7476355008a03ce8567a577b73280b">src/modules/ims_registrar_scscf/registrar_notify.c</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-b2827b724b56232d7e57f6ff6f484f5b2e17b631c03c0d815e541174a739bebb">src/modules/ims_registrar_scscf/save.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-25661bf52b3f77d3bbafb126cc6ef0c7f424b6b6d3048aac4f411b8c1ad59017">src/modules/ims_usrloc_scscf/impurecord.c</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-f147bda30a945dc58519edd7ad71e4bfdc972a46a1f6aef76722712d2e13b48c">src/modules/nat_traversal/nat_traversal.c</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2894/files#diff-c70df078165fad8bab0a84c6082cb4631aeedd1aa43e354de57d53cf26bdc9ab">src/modules/xhttp_pi/xhttp_pi_fnc.c</a>
    (4)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/2894.patch'>https://github.com/kamailio/kamailio/pull/2894.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/2894.diff'>https://github.com/kamailio/kamailio/pull/2894.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2894">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIDRIFDQKK4RNRLC73UIGSPXANCNFSM5GRDMKEA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/ABO7UZJYNMCP42UHK4N343TUIGSPXA5CNFSM5GRDMKEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4PM7CHCA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2894",
"url": "https://github.com/kamailio/kamailio/pull/2894",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>