mirror of
https://github.com/NeoFlock/neonucleus.git
synced 2025-09-24 09:03:32 +02:00
time is now a thing
This commit is contained in:
parent
dac305a1a1
commit
708d090ba2
@ -145,6 +145,7 @@ void nn_unsafeDeleteUniverse(nn_universe *universe);
|
||||
void *nn_queryUserdata(nn_universe *universe, const char *name);
|
||||
void nn_storeUserdata(nn_universe *universe, const char *name, void *data);
|
||||
void nn_setClock(nn_universe *universe, nn_clock_t *clock, void *userdata);
|
||||
double nn_getTime(nn_universe *universe);
|
||||
|
||||
nn_computer *nn_newComputer(nn_universe *universe, nn_address address, nn_architecture *arch, void *userdata, size_t memoryLimit, size_t componentLimit);
|
||||
void nn_tickComputer(nn_computer *computer);
|
||||
|
@ -7,6 +7,8 @@ nn_universe *nn_newUniverse() {
|
||||
if(u == NULL) return u;
|
||||
// we leave udata uninitialized because it does not matter
|
||||
u->udataLen = 0;
|
||||
u->clockUserdata = NULL;
|
||||
u->currentClock = nn_realTimeClock;
|
||||
return u;
|
||||
}
|
||||
|
||||
@ -36,3 +38,7 @@ void nn_storeUserdata(nn_universe *universe, const char *name, void *data) {
|
||||
universe->udata[idx].userdata = data;
|
||||
universe->udataLen++;
|
||||
}
|
||||
|
||||
double nn_getTime(nn_universe *universe) {
|
||||
return universe->currentClock(universe->clockUserdata);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user