Re: I get odd time reports from poudriere on armv7 system, under a (non-debug) main [so: 14] FreeBSD.

From: Mark Millard via freebsd-ports <freebsd-ports_at_freebsd.org>
Date: Mon, 27 Sep 2021 06:05:46 UTC
On 2021-Sep-26, at 10:02, Ian Lepore <ian at freebsd.org> wrote:

> On Sun, 2021-09-26 at 02:27 -0700, Mark Millard via freebsd-current
> wrote:
>> On 2021-Sep-25, at 23:25, Mark Millard <marklmi at yahoo.com> wrote:
>> 
>> 
>> [...]
>>         if (argc == 3 && strcmp(argv[2], "-nsec") == 0)
>>                 printf("%ld.%ld\n", ts.tv_sec, ts.tv_nsec);
> 
> There are two problems with this, both the seconds and nanos are
> printed incorrectly.  The correct incantation would be
> 
>  printf("%jd.%09ld\n", (intmax_t)ts.tv_sec, ts.tv_nsec);
> 

Thanks Ian for looking into more than I did last night.

Based on the following (up to possible e-mail white space issues),
poudriere-devel seems t be working for reporting times:

# more /usr/ports/ports-mgmt/poudriere-devel/files/patch-clock 
--- src/libexec/poudriere/clock/clock.c.orig    2021-09-26 22:24:54.735485000 -0700
+++ src/libexec/poudriere/clock/clock.c 2021-09-26 11:46:12.076362000 -0700
@@ -24,6 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <stdint.h>
 #include <err.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -71,8 +72,8 @@
        } else
                usage();
        if (argc == 3 && strcmp(argv[2], "-nsec") == 0)
-               printf("%ld.%ld\n", ts.tv_sec, ts.tv_nsec);
+               printf("%jd.%09ld\n", (intmax_t)ts.tv_sec, ts.tv_nsec);
        else
-               printf("%ld\n", ts.tv_sec);
+               printf("%jd\n", (intmax_t)ts.tv_sec);
        return (EXIT_SUCCESS);
 }



===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)