/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "epoch.h" void epochInit(epoch_t *epoch) { epoch->delta = EPOCH_FIXED_STEP; epoch->last = EPOCH_FIXED_STEP; epoch->current = EPOCH_FIXED_STEP + EPOCH_FIXED_STEP; } void epochUpdate(epoch_t *epoch, float platformDelta) { platformDelta = mathClamp(platformDelta, 0, EPOCH_FIXED_STEP); epoch->last = epoch->current; epoch->current = epoch->current + platformDelta; epoch->delta = epoch->current - epoch->last; epoch->fixedDelta = EPOCH_FIXED_STEP; }