MCPcopy Create free account
hub / github.com/apache/httpd / log_ctime

Function log_ctime

server/log.c:657–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657static int log_ctime(const ap_errorlog_info *info, const char *arg,
658 char *buf, int buflen)
659{
660 int time_len = buflen;
661 int option = AP_CTIME_OPTION_NONE;
662
663 if (arg) {
664 if (arg[0] == 'u' && !arg[1]) { /* no ErrorLogFormat (fast path) */
665 option |= AP_CTIME_OPTION_USEC;
666 }
667 else if (arg[0] == 'm' && !arg[1]) { /* no ErrorLogFormat (fast path) - msec */
668 option |= AP_CTIME_OPTION_MSEC;
669 }
670 else if (!ap_strchr_c(arg, '%')) { /* special "%{mcuz}t" formats */
671 while (*arg) {
672 switch (*arg++) {
673 case 'm':
674 option |= AP_CTIME_OPTION_MSEC;
675 break;
676 case 'u':
677 option |= AP_CTIME_OPTION_USEC;
678 break;
679 case 'c':
680 option |= AP_CTIME_OPTION_COMPACT;
681 break;
682 case 'z':
683 option |= AP_CTIME_OPTION_GMTOFF;
684 break;
685 }
686 }
687 }
688 else { /* "%{strftime %-format}t" */
689 apr_size_t len = 0;
690 apr_time_exp_t expt;
691 ap_explode_recent_localtime(&expt, apr_time_now());
692 apr_strftime(buf, &len, buflen, arg, &expt);
693 return (int)len;
694 }
695 }
696
697 ap_recent_ctime_ex(buf, apr_time_now(), option, &time_len);
698
699 /* ap_recent_ctime_ex includes the trailing \0 in time_len */
700 return time_len - 1;
701}
702
703static int log_loglevel(const ap_errorlog_info *info, const char *arg,
704 char *buf, int buflen)

Callers 1

do_errorlog_defaultFunction · 0.85

Calls 3

ap_strchr_cFunction · 0.85
ap_recent_ctime_exFunction · 0.85

Tested by

no test coverage detected