shithub: 3dee

Download patch

ref: eae6ff156c4890c2f952fc5b13eff61698022779
parent: a77681339f28c65a24d8af0f6178beb5b5886853
author: rodri <rgl@antares-labs.eu>
date: Thu Mar 13 16:52:20 EDT 2025

use libgraphics's nanosec().

--- a/med.c
+++ b/med.c
@@ -159,7 +159,7 @@
 
 	m->i = eallocimage(display, Rpt(off, addpt(off, dim)), XRGB32, 0, DNofill);
 	stringbg(m->i, m->i->r.min, display->white, ZP, font, m->s, display->black, ZP);
-	m->eol = nsec() + 5*SEC;
+	m->eol = nanosec() + 5*SEC;
 
 	qlock(l);
 	m->prev = l->msgs.prev;
@@ -192,7 +192,7 @@
 	qlock(l);
 	for(m = l->msgs.next; m != &l->msgs; m = nm){
 		nm = m->next;
-		if(nsec() >= m->eol)
+		if(nanosec() >= m->eol)
 			l->delmsg(l, m);
 	}
 	qunlock(l);
@@ -447,7 +447,7 @@
 	draw(bg, bg->r, mist, nil, ZP);
 	freeimage(mist);
 
-	t0 = nsec();
+	t0 = nanosec();
 	for(;;){
 		qlock(&scenelk);
 		shootcamera(cam, shader);
@@ -455,7 +455,7 @@
 
 		shootcamera(compass.cam, getshader("ident"));
 
-		Δt = nsec() - t0;
+		Δt = nanosec() - t0;
 		if(Δt > HZ2MS(60)*1000000ULL){
 			lockdisplay(display);
 			draw(screenb, screenb->r, bg, nil, ZP);
--- a/solar.c
+++ b/solar.c
@@ -541,10 +541,10 @@
 
 	bg = eallocimage(display, UR, XRGB32, 1, DBlack);
 
-	t0 = nsec();
+	t0 = nanosec();
 	for(;;){
 		shootcamera(camera, &shader);
-		Δt = nsec() - t0;
+		Δt = nanosec() - t0;
 		if(Δt > HZ2MS(60)*1000000ULL){
 			lockdisplay(display);
 			draw(screenb, screenb->r, bg, nil, ZP);
--- a/vis.c
+++ b/vis.c
@@ -186,7 +186,7 @@
 			sysfatal("readmemimage: %r");
 	}
 
-	t0 = nsec();
+	t0 = nanosec();
 	for(;;){
 		time = t0;
 		setuniform(shader, "time", VANumber, &time);
@@ -193,7 +193,7 @@
 
 		shootcamera(maincam, shader);
 
-		Δt = nsec() - t0;
+		Δt = nanosec() - t0;
 		if(Δt > HZ2MS(60)*1000000ULL){
 			lockdisplay(display);
 			draw(screenb, screenb->r, clr, nil, ZP);