Skip to content

Commit

Permalink
DEMO: add epoch time to fullserverinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscon committed Mar 5, 2024
1 parent 1c1b778 commit 0006b95
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sv_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ void SV_MVD_SendInitialGamestate(mvddest_t* dest)
unsigned char buf_data[MAX_MSGLEN];
unsigned int n;
char* s, info[MAX_EXT_INFO_STRING];
char epoch[20];

This comment has been minimized.

Copy link
@jite

jite Mar 6, 2024

This oughta be 21 to allow for NUL term on 64bit?

This comment has been minimized.

Copy link
@ciscon

ciscon Mar 6, 2024

Author Collaborator

we could, but epoch is never going to reach 20 characters anyway heh


client_t* player;
edict_t* ent;
Expand Down Expand Up @@ -1269,6 +1270,10 @@ void SV_MVD_SendInitialGamestate(mvddest_t* dest)
MSG_WriteByte (&buf, svc_cdtrack);
MSG_WriteByte (&buf, 0); // none in demos

//set start time
sprintf(epoch,"%ld", (unsigned long)time(NULL));
Info_SetValueForKey (svs.info, "epoch", epoch, MAX_SERVERINFO_STRING);

// send server info string
MSG_WriteByte (&buf, svc_stufftext);
MSG_WriteString (&buf, va("fullserverinfo \"%s\"\n", svs.info) );
Expand Down

0 comments on commit 0006b95

Please sign in to comment.