correct logger rotate time near 0 clock
parent
e610e8a45d
commit
c623a6c935
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
Version 1.19 2015-07-24
|
||||||
|
* correct logger rotate time near 0 clock
|
||||||
|
|
||||||
Version 1.18 2015-07-15
|
Version 1.18 2015-07-15
|
||||||
* OS macro defines put in _os_define.h
|
* OS macro defines put in _os_define.h
|
||||||
* remove file _os_bits.h
|
* remove file _os_bits.h
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
%define LibFastcommonDevel libfastcommon-devel
|
%define LibFastcommonDevel libfastcommon-devel
|
||||||
|
|
||||||
Name: libfastcommon
|
Name: libfastcommon
|
||||||
Version: 1.0.18
|
Version: 1.0.19
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: c common functions library extracted from my open source projects FastDFS
|
Summary: c common functions library extracted from my open source projects FastDFS
|
||||||
License: GPL
|
License: GPL
|
||||||
|
|
|
||||||
10
src/logger.c
10
src/logger.c
|
|
@ -520,6 +520,16 @@ int log_rotate(LogContext *pContext)
|
||||||
|
|
||||||
current_time = get_current_time();
|
current_time = get_current_time();
|
||||||
localtime_r(¤t_time, &tm);
|
localtime_r(¤t_time, &tm);
|
||||||
|
if (tm.tm_hour == 0 && tm.tm_min <= 1)
|
||||||
|
{
|
||||||
|
if (strstr(pContext->rotate_time_format, "%H") == NULL
|
||||||
|
&& strstr(pContext->rotate_time_format, "%M") == NULL
|
||||||
|
&& strstr(pContext->rotate_time_format, "%S") == NULL)
|
||||||
|
{
|
||||||
|
current_time -= 120;
|
||||||
|
localtime_r(¤t_time, &tm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
memset(old_filename, 0, sizeof(old_filename));
|
memset(old_filename, 0, sizeof(old_filename));
|
||||||
len = sprintf(old_filename, "%s.", pContext->log_filename);
|
len = sprintf(old_filename, "%s.", pContext->log_filename);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue