mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 13:55:38 +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)
|
||||||
{
|
{
|
||||||
time_t currentTime;
|
static time_t oldTime{0};
|
||||||
struct tm *Time;
|
time_t currentTime;
|
||||||
|
static struct tm *Time;
|
||||||
|
|
||||||
time(¤tTime);
|
time(¤tTime);
|
||||||
Time = localtime(¤tTime);
|
if (currentTime != oldTime)
|
||||||
|
{
|
||||||
|
Time = localtime(¤tTime);
|
||||||
|
oldTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
switch (reg&0xF)
|
switch (reg&0xF)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue