mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Merge branch 'robin/topic/writer-info'
* robin/topic/writer-info: Extending the log writer DoInit() API. Reworking log writer API to make it easier to pass additional information to a writer's initialization method. Conflicts: src/logging/WriterBackend.cc src/logging/WriterBackend.h src/logging/WriterFrontend.cc
This commit is contained in:
commit
90763bb2f2
27 changed files with 371 additions and 92 deletions
25
src/util.cc
25
src/util.cc
|
@ -1090,18 +1090,8 @@ const char* log_file_name(const char* tag)
|
|||
return fmt("%s.%s", tag, (env ? env : "log"));
|
||||
}
|
||||
|
||||
double calc_next_rotate(double interval, const char* rotate_base_time)
|
||||
double parse_rotate_base_time(const char* rotate_base_time)
|
||||
{
|
||||
double current = network_time;
|
||||
|
||||
// Calculate start of day.
|
||||
time_t teatime = time_t(current);
|
||||
|
||||
struct tm t;
|
||||
t = *localtime(&teatime);
|
||||
t.tm_hour = t.tm_min = t.tm_sec = 0;
|
||||
double startofday = mktime(&t);
|
||||
|
||||
double base = -1;
|
||||
|
||||
if ( rotate_base_time && rotate_base_time[0] != '\0' )
|
||||
|
@ -1113,6 +1103,19 @@ double calc_next_rotate(double interval, const char* rotate_base_time)
|
|||
base = t.tm_min * 60 + t.tm_hour * 60 * 60;
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
double calc_next_rotate(double current, double interval, double base)
|
||||
{
|
||||
// Calculate start of day.
|
||||
time_t teatime = time_t(current);
|
||||
|
||||
struct tm t;
|
||||
t = *localtime_r(&teatime, &t);
|
||||
t.tm_hour = t.tm_min = t.tm_sec = 0;
|
||||
double startofday = mktime(&t);
|
||||
|
||||
if ( base < 0 )
|
||||
// No base time given. To get nice timestamps, we round
|
||||
// the time up to the next multiple of the rotation interval.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue