<p></p>
<p><b>@fjmolinas</b> approved this pull request.</p>

<p>I played a bit with making the overflow more explicit to the user but it increases code size quite a bit, I'm sure we can improve this by using <code>fmt</code> instead but maybe there is not use case is enough and the warning in <code>ps.c</code> is enough, but for future reference something like the following could be done:</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/sys/ps/ps.c b/sys/ps/ps.c</span>
index 5fe1acf050..68d4826d31 100644
<span class="pl-md">--- a/sys/ps/ps.c</span>
<span class="pl-mi1">+++ b/sys/ps/ps.c</span>
<span class="pl-mdr">@@ -52,7 +52,7 @@</span> void ps(void)
            "| stack  ( used) ( free) | base addr  | current     "
 #endif
 #ifdef MODULE_SCHEDSTATISTICS
<span class="pl-md"><span class="pl-md">-</span>           "| runtime  | switches  | runtime_usec "</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>           "| runtime  | switches  | runtime_us"</span>
 #endif
            "\n",
 #ifdef CONFIG_THREAD_NAMES
<span class="pl-mdr">@@ -104,7 +104,14 @@</span> void ps(void)
 #ifdef MODULE_SCHEDSTATISTICS
             /* multiply with 100 for percentage and to avoid floats/doubles */
             uint64_t runtime_ticks = sched_pidlist[i].runtime_ticks * 100;
<span class="pl-md"><span class="pl-md">-</span>            xtimer_ticks32_t xtimer_ticks = {sched_pidlist[i].runtime_ticks};</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            xtimer_ticks64_t ticks = { sched_pidlist[i].runtime_ticks };</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            uint64_t runtime_us = xtimer_usec_from_ticks64(ticks);</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            char buf[10];</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            if (runtime_us <= UINT32_MAX) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                sprintf(buf, "%10"PRIu32"", (uint32_t) runtime_us);</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            } else {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                sprintf(buf, "overflown");</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>            }</span>
             unsigned runtime_major = runtime_ticks / rt_sum;
             unsigned runtime_minor = ((runtime_ticks % rt_sum) * 1000) / rt_sum;
             unsigned switches = sched_pidlist[i].schedules;
<span class="pl-mdr">@@ -118,7 +125,7 @@</span> void ps(void)
                    " | %6i (%5i) (%5i) | %10p | %10p "
 #endif
 #ifdef MODULE_SCHEDSTATISTICS
<span class="pl-md"><span class="pl-md">-</span>                   " | %2d.%03d%% |  %8u  | %10"PRIu32" "</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                   " | %2d.%03d%% |  %8u  | %s "</span>
 #endif
                    "\n",
                    p->pid,
<span class="pl-mdr">@@ -131,7 +138,7 @@</span> void ps(void)
                    (void *)p->stack_start, (void *)p->sp
 #endif
 #ifdef MODULE_SCHEDSTATISTICS
<span class="pl-md"><span class="pl-md">-</span>                   , runtime_major, runtime_minor, switches, xtimer_usec_from_ticks(xtimer_ticks)</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                   , runtime_major, runtime_minor, switches, buf</span>
 #endif
                   );
         }</pre></div>

<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/RIOT-OS/RIOT/pull/16470#pullrequestreview-671209754">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYEKRFCCJCK7XMHJNSLTP56FBANCNFSM44YU4XMQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYDCGHDTTFAPD5ILAWDTP56FBA5CNFSM44YU4XM2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFAA5SGQ.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/RIOT-OS/RIOT/pull/16470#pullrequestreview-671209754",
"url": "https://github.com/RIOT-OS/RIOT/pull/16470#pullrequestreview-671209754",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>