Skip to content
Snippets Groups Projects
Commit b0f9af53 authored by rswindell's avatar rswindell
Browse files

Always display HH:MM:SS format when 24-hour (Military) time format is enabled

in SCFG->System->Toggle Options.
parent 01044f93
No related branches found
No related tags found
No related merge requests found
......@@ -228,8 +228,8 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
memset(&tm,0,sizeof(tm));
localtime_r(&now,&tm);
if(cfg.sys_misc&SM_MILITARY)
safe_snprintf(str,maxlen,"%02d:%02d"
,tm.tm_hour,tm.tm_min);
safe_snprintf(str,maxlen,"%02d:%02d:%02d"
,tm.tm_hour,tm.tm_min,tm.tm_sec);
else
safe_snprintf(str,maxlen,"%02d:%02d %s"
,tm.tm_hour==0 ? 12
......@@ -453,10 +453,14 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen)
if(!strcmp(sp,"LASTTIMEON")) {
memset(&tm,0,sizeof(tm));
localtime32(&useron.laston,&tm);
safe_snprintf(str,maxlen,"%02d:%02d %s"
,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12
: tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
if(cfg.sys_misc&SM_MILITARY)
safe_snprintf(str,maxlen,"%02d:%02d:%02d"
,tm.tm_hour, tm.tm_min, tm.tm_sec);
else
safe_snprintf(str,maxlen,"%02d:%02d %s"
,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12
: tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
return(str);
}
......
......@@ -458,10 +458,14 @@ void sbbs_t::ctrl_a(char x)
case 'T': /* Time */
now=time(NULL);
localtime_r(&now,&tm);
bprintf("%02d:%02d %s"
,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12
: tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
if(cfg.sys_misc&SM_MILITARY)
bprintf("%02u:%02u:%02u"
,tm.tm_hour, tm.tm_min, tm.tm_sec);
else
bprintf("%02d:%02d %s"
,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12
: tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
break;
case 'D': /* Date */
now=time(NULL);
......
......@@ -1934,10 +1934,14 @@ js_html_encode(JSContext *cx, uintN argc, jsval *arglist)
case 'T':
now=time(NULL);
localtime_r(&now,&tm);
j+=sprintf(outbuf+j,"%02d:%02d %s"
,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12
: tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
if(p->cfg->sys_misc&SM_MILITARY)
j+=sprintf(outbuf+j,"%02d:%02d:%02d"
,tm.tm_hour, tm.tm_min, tm.tm_sec);
else
j+=sprintf(outbuf+j,"%02d:%02d %s"
,tm.tm_hour==0 ? 12
: tm.tm_hour>12 ? tm.tm_hour-12
: tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
break;
case 'L':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment