diff --git a/src/media/media_recorder.cpp b/src/media/media_recorder.cpp
index a45b9f232079aaa95d01046dd62911f46a87ac05..58a0c0f8081a07a027dc6d80e1f447c110123736 100644
--- a/src/media/media_recorder.cpp
+++ b/src/media/media_recorder.cpp
@@ -144,10 +144,11 @@ MediaRecorder::toggleRecording()
 int
 MediaRecorder::startRecording()
 {
+    std::time_t t = std::time(nullptr);
+    startTime_ = *std::localtime(&t);
+
     if (path_.empty()) {
         // FIXME deprecated code, will be removed once all clients transitioned to startRecording(path).
-        std::time_t t = std::time(nullptr);
-        startTime_ = *std::localtime(&t);
         std::stringstream ss;
         ss << std::put_time(&startTime_, "%Y%m%d-%H%M%S");
         filename_ = ss.str();