Skip to content

Commit 042639a

Browse files
chiarazampollishahor02
authored andcommitted
Fix conversion from string to seconds
For some reason, libstdc seems to have issues parsing the month ("%b" option), so now I use the SQL format.
1 parent c56e928 commit 042639a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Detectors/DCS/src/DataPointGenerator.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ std::pair<uint32_t, uint16_t> getDate(const std::string& refDate)
3434
std::tm t{};
3535
std::istringstream ss(refDate);
3636
ss >> std::get_time(&t, "%Y-%b-%d %H:%M:%S");
37-
if (ss.fail()) { // let's see if it was passed as a TDatime
37+
if (ss.fail()) { // let's see if it was passed as a TDatime, as SQL string
3838
std::tm tt{};
3939
std::istringstream sss(refDate);
40-
sss >> std::get_time(&tt, "%a %b %d %H:%M:%S %Y");
40+
sss >> std::get_time(&tt, "%Y-%m-%d %H:%M:%S");
4141
if (sss.fail()) {
4242
LOG(ERROR) << "We cannot parse the date";
4343
}

Detectors/DCS/testWorkflow/src/DCSRandomDataGeneratorSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ std::vector<o2::dcs::DataPointCompositeObject> generate(const std::vector<o2::dc
7070
dsec += tfid;
7171
d.Set(dsec);
7272

73-
std::string refDate = d.AsString();
73+
std::string refDate = d.AsSQLString();
7474

7575
auto GenerateVisitor = [refDate](const auto& t) {
7676
return o2::dcs::generateRandomDataPoints({t.aliasPattern}, t.minValue, t.maxValue, refDate);

Detectors/TOF/calibration/testWorkflow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ aliases. You can specify the path of CCDB also with `--ccdb-path`.
1414
YOu can also specify to run in verbose mode (`--use-verbose-mode`)
1515

1616
```shell
17-
o2-calibration-tof-sim-workflow --max-timeframes 3 --delta-fraction 0.5 -b |
17+
o2-calibration-tof-dcs-sim-workflow --max-timeframes 3 --delta-fraction 0.5 -b |
1818
o2-calibration-tof-dcs-workflow --use-ccdb-to-configure -b |
1919
o2-calibration-ccdb-populator-workflow --ccdb-path="http://localhost:8080" -b
2020
```

0 commit comments

Comments
 (0)