Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions LabRecorder.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
; %b for task label (same as block in Legacy), %a for name of acquisition parameter set, and %r index.
; The BIDS syntax is: path/to/StudyRoot/sub-%p/ses-%s/eeg/sub-%p_ses-%s_task-%b[_acq-%a]_run-%r_eeg.xdf
;

; Additionally, %datetime will insert an ISO8601 UTC datetime with milliseconds, the day's date
; only with %date, or the current time only with %time.
;; for example syntax is: path/to/StudyRoot/LabRecorder_%datetime_eeg.xdf
;

; If neither StorageLocation or StudyRoot is provided then the default root is QStandardPaths::DocumentsLocation/CurrentStudy/
; If neither StorageLocation or PathTemplate are provided, then the BIDS format is assumed, or the file template exp%n/block_%b.xdf if BIDS is unchecked.

Expand Down
9 changes: 9 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,15 @@ QString MainWindow::replaceFilename(QString fullfile) const {
QString run = QString("%1").arg(ui->spin_counter->value(), 3, 10, QChar('0'));
fullfile.replace(counterPlaceholder(), run);

// ISO8601 UTC datetime with milliseconds
// Get current UTC once
QDateTime nowUtc = QDateTime::currentDateTimeUtc();
// Datetime replacements (filename-safe)
// QString datetime = QDateTime::currentDateTimeUtc().toString("yyyy-MM-ddTHH--mm--ss.zzzZ"); -- with double-hyphen convention as mentioned on wikipedia: https://en.wikipedia.org/wiki/ISO_8601
fullfile.replace("%datetime", nowUtc.toString("yyyy-MM-ddTHHmmss.zzzZ"));
fullfile.replace("%date", nowUtc.toString("yyyy-MM-dd"));
fullfile.replace("%time", nowUtc.toString("HHmmss.zzzZ"));

return fullfile.trimmed();
}

Expand Down