Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
2.1.2
-
None
-
-
68eceb304 (2.2)
Description
Cannot get current time, if Date() object created without any argument.
Code below working fine in Qbs 1.23, but in the latest version it becomes a time machine:
timestamp.h generated by Qbs 2.1.2:
#pragma once // timestamp: Sun Nov 15 2392 #define TIMESTAMP 13344641115
Test project:
import qbs.TextFile CppApplication { name: "TestApp" files: "main.cpp" cpp.includePaths: [ product.destinationDirectory, // for timestamp ] // generate timestamp header Rule { alwaysRun: true multiplex: true Artifact { filePath: "timestamp.h" fileTags: "hpp" } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "generating " + output.fileName; cmd.sourceCode = function() { var f = new TextFile(output.filePath, TextFile.WriteOnly); const d = new Date(); const utc = Math.floor(d.getTime() / 1000); // in seconds try { f.writeLine("#pragma once"); f.writeLine("// timestamp: " + d.toDateString()) f.writeLine("#define TIMESTAMP " + utc) } finally { f.close(); } }; return [cmd]; } } }