Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 May 2024 07:53:02 GMT
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7b8b613d08d0 - main - fattime: make the test code build again
Message-ID:  <202405010753.4417r2UG080876@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tsoome:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b8b613d08d07bc0619685c59219e41517f337bf

commit 7b8b613d08d07bc0619685c59219e41517f337bf
Author:     Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
AuthorDate: 2024-04-29 13:40:29 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2024-05-01 04:56:41 +0000

    fattime: make the test code build again
    
    This change...
    
    1. replaces calls to timet2fattime/fattime2timet with calls to
       timespec2fattime/fattime2timespec.  The functions got renamed shortly
       after they landed in the kernel but the test code wasn't updated (see
       7ea93e912bf0ef).
    2. adds a utc_offset stub.
    
    With this, the test code builds and runs as a 32-bit binary (cc -Wall -O2
    -m32 subr_fattime.c).
    
    Reviewed by: imp
    Differential Revision: https://reviews.freebsd.org/D44753
---
 sys/kern/subr_fattime.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/kern/subr_fattime.c b/sys/kern/subr_fattime.c
index 665131e5b32b..bdbc4e11827a 100644
--- a/sys/kern/subr_fattime.c
+++ b/sys/kern/subr_fattime.c
@@ -75,6 +75,11 @@
 #include <sys/time.h>
 #include <sys/clock.h>
 
+#ifdef TEST_DRIVER
+/* stub for testing */
+#define utc_offset() 0
+#endif
+
 #define DAY	(24 * 60 * 60)	/* Length of day in seconds */
 #define YEAR	365		/* Length of normal year */
 #define LYC	(4 * YEAR + 1)	/* Length of 4 year leap-year cycle */
@@ -282,7 +287,7 @@ main(int argc __unused, char **argv __unused)
 
 		a = ts.tv_sec + ts.tv_nsec * 1e-9;
 		d = t = p = 0;
-		timet2fattime(&ts, &d, &t, &p);
+		timespec2fattime(&ts, 1, &d, &t, &p);
 		printf("%04x %04x %02x -- ", d, t, p);
 		printf("%3d %02d %02d %02d %02d %02d -- ",
 		    ((d >> 9)  & 0x7f) + 1980,
@@ -293,7 +298,7 @@ main(int argc __unused, char **argv __unused)
 		    ((t >> 0)  & 0x1f) * 2);
 
 		ts.tv_sec = ts.tv_nsec = 0;
-		fattime2timet(d, t, p, &ts);
+		fattime2timespec(d, t, p, 1, &ts);
 		printf("%10d.%03ld == ", ts.tv_sec, ts.tv_nsec / 1000000);
 		gmtime_r(&ts.tv_sec, &tm);
 		strftime(buf, sizeof buf, "%Y %m %d %H %M %S", &tm);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405010753.4417r2UG080876>