summaryrefslogtreecommitdiff
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/writer.c b/src/writer.c
index f45422c..f89adfb 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -167,12 +167,25 @@ static int check_boundaries(writer_t* writer)
int ret = open_file(&(writer->next_));
// if(ret) return ret; // TODO: stop writer on open_file error ???
- // - add new file
- // - remove old file
+ // - add new file
+ // - remove old file
- // - calculate next filename and boundary
+ writer->old_ = writer->current_;
+ writer->current_ = writer->next_;
+
+ writer->next_boundary_.tv_sec += 3600;
+ struct tm bd_time;
+ localtime_r(&(writer->next_boundary_.tv_sec), &bd_time);
- // - call post processing script from fd_removed callback
+ ret = compute_filname(&bd_time, "next", &(writer->next_), writer->name_format_, writer->output_dir_, writer->mode_);
+ if(ret) return ret;
+
+
+ // - call post processing script from fd_removed callback
+ if(writer->old_.fd_ > 0)
+ close(writer->old_.fd_);
+ if(writer->old_.path_)
+ free(writer->old_.path_);
}
return 0;