mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-26 07:35:40 +00:00
optimize ReadRegister, as localtime (at least on MSVC/Windows) is significantly showing up in profiling
e.g. in SW Trilogy caches localtime until time changes (i.e. limits calls to 1/sec)
This commit is contained in:
parent
ba7145df52
commit
b98be0c2e7
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#include "RTC72421.h"
|
#include "RTC72421.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <ctime>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,11 +43,16 @@
|
||||||
|
|
||||||
UINT8 CRTC72421::ReadRegister(unsigned reg)
|
UINT8 CRTC72421::ReadRegister(unsigned reg)
|
||||||
{
|
{
|
||||||
|
static time_t oldTime{0};
|
||||||
time_t currentTime;
|
time_t currentTime;
|
||||||
struct tm *Time;
|
static struct tm *Time;
|
||||||
|
|
||||||
time(¤tTime);
|
time(¤tTime);
|
||||||
|
if (currentTime != oldTime)
|
||||||
|
{
|
||||||
Time = localtime(¤tTime);
|
Time = localtime(¤tTime);
|
||||||
|
oldTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
switch (reg&0xF)
|
switch (reg&0xF)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue