Hallo,
ich habe da eine kleine C++ Frage.
Mein Compiler weigert sich den Typ int64_t in time_t ohne expliziten Cast umzuwandeln.
Code:
#include <time.h>
#include <stdint.h>

int main() {
int64_t test = 1234567890;
tm* now = localtime(&test);
return 0;
}
Dieser Code ergibt als Ausgabe:
Code:
test.cpp: In function ‘int main()’:
test.cpp:7: error: invalid conversion from ‘int64_t*’ to ‘const time_t*’
test.cpp:7: error:   initializing argument 1 of ‘tm* localtime(const time_t*)’
Meine Frage ist, woran liegt das? An einer zu alten Compiler-Version? (Bei mir läuft 4.2.1) Und nein, einfach explizit zu casten ist keine brauchbare Lösung für mich.