Beispiel #1
0
string timestamp(){
    string rawtz;
    int *t, gmtoff, offset;

    gmtoff = localtime(time())[LT_GMTOFF];

    // if the gmtoffset is set to zero by the driver, then we need to
    // calculate an offset
    if (gmtoff == 0){
        // if the timezone.cfg file exists, use it else default to GMT
        rawtz = query_tz();
        offset = TIME_D->GetOffset(rawtz);
        offset += EXTRA_TIME_OFFSET;
    }
    else {
        rawtz = upper_case(localtime(time())[LT_ZONE]);
        offset = 0;
    }

    t = localtime(time()+(offset*3600));
    return sprintf("%04d.%02d.%02d-%02d.%02d", t[LT_YEAR], (t[LT_MON])+1, t[LT_MDAY], t[LT_HOUR], t[LT_MIN]);
}
Beispiel #2
0
int cmd(string str) {
    string tz, tmp, extra;
    int offset, x, scr, nr;

    if(sizeof(query_os_type())) extra = " for "+query_os_type();
    tz = this_player()->GetProperty("timezone");
    if(!tz || !valid_timezone(tz)) tz = query_tz();
    offset = TIME_D->GetOffset(tz);
    offset += EXTRA_TIME_OFFSET;
    if(query_os_type() != "windows" ) x = offset * 3600;
    else x = 0;
    scr = ((int *)this_player()->GetScreen())[0];
    nr = (time() - uptime()) + (EVENTS_D->GetRebootInterval() * 3600);
    tmp = center(mud_name(), scr) + "\n";
    tmp += sprintf("%:-"+(scr/2)+"s%"+(scr/2)+"s\n", "Driver: " + version(),
            "Library: " + mudlib() + " " + mudlib_version()+extra);
    tmp += sprintf("%:-" + (scr/2) + "s%" + (scr/2) + "s\n",
            "Up since: " + ctime((time() - uptime()) +x),
            "Next reboot: " + ctime(nr + x));
    tmp += center("Current time: " + ctime(time() + x) + " " + tz, scr);
    message("system", tmp, this_player());
    return 1;
}