File: cmdsynctime.c

package info (click to toggle)
xshipwars 1.32-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,176 kB
  • ctags: 6,357
  • sloc: ansic: 157,152; makefile: 226; sh: 75
file content (50 lines) | stat: -rw-r--r-- 1,344 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "swserv.h"


/*
 *      Syncronize time.
 */
int CmdSyncTime(int condescriptor, char *arg)
{
        long con_object_num;
        char sndbuf[CS_DATA_MAX_LEN];
        char stringa[128 + XSW_OBJ_NAME_MAX];


        /* Get con_object_num, assumed valid. */
        con_object_num = connection[condescriptor]->object_num;


        /* Check if object's permission allows sync time. */
        if(xsw_object[con_object_num]->permission.uid > ACCESS_UID_SYNCTIME)
        {
            sprintf(sndbuf,
                "synctime: Access level %i: Permission denied.",
                ACCESS_UID_SYNCTIME
            );
            NetSendLiveMessage(condescriptor, sndbuf);

            return(-1);
        }

        /* Log who requested timming reset. */
        sprintf(stringa,
            "%s: Syncronized global timmers.",
            DBGetFormalNameStr(con_object_num)
        );
        if(sysparm.log_general == 1)
            LogAppendLineFormatted(fname.primary_log, stringa);


        /* Warn all connections about timming reset. */
        NetSendLiveMessage(-1, "Server: Syncing global timmers...");

        /* Reset all global timmers. */
        SWServDoResetTimmers();

        /* Warn all connections about timming reset. */
        NetSendLiveMessage(-1, "Server: Global timmers syncronized.");


        return(0);
}