Real time clock possible?

PoisonHeadcrab

L1: Registered
Jun 27, 2010
14
0
So, I'm trying to include a clock in my map that would show the actual (server) time. Is there any way to parse the server time for this without using server plugins, for example at the start of the map?


Any help would be greatly appreciated. :)
 

Seba

DR. BIG FUCKER, PHD
aa
Jun 9, 2009
2,364
2,728
Without server plugins, I don't think so. Maps tend to be self-contained.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
That is either irrelevant or infeasible.

If it follows suit with the CurrentTime material proxy it is the elapsed map time, not the server's system clock. Mind you, very few things in the engine care at all what time it is, no reason for much to be hooked into it. I would say none, but TF2 does have the birthday mode that turns on, other than that I don't think there is anything actually.

If it is actually the system time, not only would you have to find out what format it is in, but since there is no way to "parse apart" variables within the proxy system the only possible use would be an animated texture with a frame for every single second (assuming it returned the time to that precision) of the day, or more.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
I was bored so I dug through the source. It is in fact the same thing in both situations.

void CMaterialModifyControl::SetMaterialVarToCurrentTime( inputdata_t &inputdata )
{
char temp[32];
Q_snprintf( temp, 32, "%f", gpGlobals->curtime );
Q_strncpy( m_szMaterialVarValue.GetForModify(), temp, MATERIAL_MODIFY_STRING_SIZE );
m_nModifyMode = MATERIAL_MODIFY_MODE_SETVAR;
}

void CTimeMaterialProxy::OnBind( void *pC_BaseEntity )
{
SetFloatResult( gpGlobals->curtime );
}
 

PoisonHeadcrab

L1: Registered
Jun 27, 2010
14
0
I was bored so I dug through the source. It is in fact the same thing in both situations.

Well that's weird, since the descriptions from the wiki would contradict in this case. I guess it's time to try them out then, however I'm rather new to that proxy stuff for materials, would anyone happen to know any good tutorials to go with? :p

Anyways, thanks a lot for the responses.
 
Last edited:

Penguin

Clinically Diagnosed with Small Mapper's Syndrome
aa
May 21, 2009
2,039
1,484
Boojum is right; my idea is broken.

I think a math remap could save it but I am not sure.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
"to the current time on the server" is what it does, they don't really contradict each other, one is just more explicit. If you turn on developer 2 to enable entity I/O spew to the console, you'll see each event is prefixed with the server time, in seconds elapsed since the map loaded.
That said, the description of the proxy actually used to be just as vague, but was recently changed to define it as elapsed seconds, so I figure someone finally tested/used it.

There basically isn't a way to do what you want.