C99 Compliance #29

Merged
jordan merged 11 commits from c99 into master 2024-01-13 22:13:46 +00:00
6 changed files with 8 additions and 8 deletions
Showing only changes of commit f2e8334faf - Show all commits

View file

@ -85,7 +85,7 @@ CronThread(void *args)
pthread_mutex_lock(&cron->lock); pthread_mutex_lock(&cron->lock);
ts = UtilServerTs(); ts = UtilTsMillis();
for (i = 0; i < ArraySize(cron->jobs); i++) for (i = 0; i < ArraySize(cron->jobs); i++)
{ {
@ -103,7 +103,7 @@ CronThread(void *args)
Free(job); Free(job);
} }
} }
te = UtilServerTs(); te = UtilTsMillis();
pthread_mutex_unlock(&cron->lock); pthread_mutex_unlock(&cron->lock);

View file

@ -587,7 +587,7 @@ DbLockFromArr(Db * db, Array * args)
if (db->cache) if (db->cache)
{ {
ref->ts = UtilServerTs(); ref->ts = UtilTsMillis();
ref->size = DbComputeSize(ref->json); ref->size = DbComputeSize(ref->json);
HashMapSet(db->cache, hash, ref); HashMapSet(db->cache, hash, ref);
db->cacheSize += ref->size; db->cacheSize += ref->size;

View file

@ -488,7 +488,7 @@ HttpServerWorkerThread(void *args)
* TODO: Instead of looping, abort immediately, and place the request * TODO: Instead of looping, abort immediately, and place the request
* at the end of the queue. * at the end of the queue.
*/ */
firstRead = UtilServerTs(); firstRead = UtilTsMillis();
while ((lineLen = UtilGetLine(&line, &lineSize, fp)) == -1 while ((lineLen = UtilGetLine(&line, &lineSize, fp)) == -1
&& errno == EAGAIN) && errno == EAGAIN)
{ {
@ -496,7 +496,7 @@ HttpServerWorkerThread(void *args)
// If the server is stopped, or it's been a while, just // If the server is stopped, or it's been a while, just
// give up so we aren't wasting a thread on this client. // give up so we aren't wasting a thread on this client.
if (server->stop || (UtilServerTs() - firstRead) > (1000 * 30)) if (server->stop || (UtilTsMillis() - firstRead) > (1000 * 30))
{ {
goto finish; goto finish;
} }

View file

@ -141,7 +141,7 @@ RandIntN(uint32_t *buf, size_t size, uint32_t max)
if (!state) if (!state)
{ {
/* Generate a seed from the system time, PID, and TID */ /* Generate a seed from the system time, PID, and TID */
uint64_t ts = UtilServerTs(); uint64_t ts = UtilTsMillis();
uint32_t seed = ts ^ getpid() ^ (unsigned long) pthread_self(); uint32_t seed = ts ^ getpid() ^ (unsigned long) pthread_self();
state = Malloc(sizeof(RandState)); state = Malloc(sizeof(RandState));

View file

@ -49,7 +49,7 @@
#endif #endif
uint64_t uint64_t
UtilServerTs(void) UtilTsMillis(void)
{ {
struct timeval tv; struct timeval tv;

View file

@ -60,7 +60,7 @@
* overflow before it even gets to this function, which will cause this * overflow before it even gets to this function, which will cause this
* function to produce unexpected results. * function to produce unexpected results.
*/ */
extern uint64_t UtilServerTs(void); extern uint64_t UtilTsMillis(void);
/** /**
* Use * Use