~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH hare v2 1/2] rt/test: fix timespec diff calculation

Details
Message ID
<20221024054517.8607-1-vyivel@eclair.cafe>
DKIM signature
missing
Download raw message
Patch: +14 -4
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
---
Since v1: no changes.

 rt/+test/+freebsd.ha | 9 +++++++--
 rt/+test/+linux.ha   | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/rt/+test/+freebsd.ha b/rt/+test/+freebsd.ha
index e815bea2..6d31844a 100644
--- a/rt/+test/+freebsd.ha
+++ b/rt/+test/+freebsd.ha
@@ -11,6 +11,11 @@ fn time_start() void = {
fn time_stop() (size, size) = {
	let end: timespec = timespec { ... };
	clock_gettime(CLOCK_MONOTONIC, &end) as void;
	return ((end.tv_sec - start.tv_sec): size,
		(end.tv_nsec - start.tv_nsec): size / 10000z);
	let sec_diff = end.tv_sec - start.tv_sec;
	let nsec_diff = end.tv_nsec - start.tv_nsec;
	if (nsec_diff < 0) {
		nsec_diff += 1000000000;
		sec_diff -= 1;
	};
	return (sec_diff: size, nsec_diff: size / 1000000z);
};
diff --git a/rt/+test/+linux.ha b/rt/+test/+linux.ha
index 89b0fe41..ff5c2424 100644
--- a/rt/+test/+linux.ha
+++ b/rt/+test/+linux.ha
@@ -12,6 +12,11 @@ fn time_start() void = {
fn time_stop() (size, size) = {
	let end: timespec = timespec { ... };
	clock_gettime(CLOCK_MONOTONIC, &end) as void;
	return ((end.tv_sec - start.tv_sec): size,
		(end.tv_nsec - start.tv_nsec): size / 10000z);
	let sec_diff = end.tv_sec - start.tv_sec;
	let nsec_diff = end.tv_nsec - start.tv_nsec;
	if (nsec_diff < 0) {
		nsec_diff += 1000000000;
		sec_diff -= 1;
	};
	return (sec_diff: size, nsec_diff: size / 1000000z);
};
-- 
2.38.1

[PATCH hare v2 2/2] rt/test: fix milliseconds formatting

Details
Message ID
<20221024054517.8607-2-vyivel@eclair.cafe>
In-Reply-To
<20221024054517.8607-1-vyivel@eclair.cafe> (view parent)
DKIM signature
missing
Download raw message
Patch: +5 -0
Pad milliseconds with zeroes; the number is guaranteed to be in [0, 999]
range so these two checks are enough.

Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
---
Since v1: reformatted the code.

 rt/+test/run.ha | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rt/+test/run.ha b/rt/+test/run.ha
index 7e0635ea..a86ea7da 100644
--- a/rt/+test/run.ha
+++ b/rt/+test/run.ha
@@ -89,6 +89,11 @@ export fn tests_main() size = {
	print(" tests completed in ");
	print(ztos(end.0));
	print(".");
	if (end.1 < 10) {
		print("00");
	} else if (end.1 < 100) {
		print("0");
	};
	print(ztos(end.1));
	print("s\n");

-- 
2.38.1

[hare/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CNTX03HVR9RC.RX53HYVMOSUW@cirno2>
In-Reply-To
<20221024054517.8607-2-vyivel@eclair.cafe> (view parent)
DKIM signature
missing
Download raw message
hare/patches: SUCCESS in 1m39s

[rt/test: fix timespec diff calculation][0] v2 from [Kirill Primak][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/36347
[1]: vyivel@eclair.cafe

✓ #868071 SUCCESS hare/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/868071
✓ #868072 SUCCESS hare/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/868072

Re: [PATCH hare v2 2/2] rt/test: fix milliseconds formatting

Details
Message ID
<CNTYFFZELRF7.36I7YG3MN95F@attila>
In-Reply-To
<20221024054517.8607-2-vyivel@eclair.cafe> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~sircmpwn/hare
   ce1d933f..b00d4a6f  master -> master
Reply to thread Export thread (mbox)