There must be some other problems because the code is definitely working. The nullptr was rejected because you obviously don’t use c++11. But NULL and nullptr are basically the same…
time_t actually is a typedef’d long. Try type-casting it.
Here you can see examples using time as well as using std::chrono:
That’s incorrect. They are totally different. NULL and 0 are basically the same. NULL is just a typedef to the number value of 0, but nullptr is a pointer type as well as a keyword.
In C++, the definition of NULL is 0, so there is only an aesthetic difference. I prefer to avoid macros, so I use 0. Another problem with NULL is that people sometimes mistakenly believe that it is different from 0 and/or not an integer. In pre-standard code, NULL was/is sometimes defined to something unsuitable and therefore had/has to be avoided. That’s less common these days.
If you have to name the null pointer, call it nullptr; that’s what it’s called in C++11. Then, “nullptr” will be a keyword.