Not portable. With the understanding that the standard does not define what is happening, you can usually define any symbols and functions that you like in the std namespace, or a link to the library that defines these symbols, or something else. This is just undefined behavior. So all you can do is suck it and look, and hope that it does not break in the next version of your compiler.
However, most compilers are likely to work mostly if you avoid colliding with one definition with the "real" std :: time. This is due to the fact that most compilers actually do nothing special with the std namespace, and the header files and libraries that they use to implement it do not really differ from the header and library files that you could write yourself.
Dima is absolutely right, however, that it is non-standard, it is almost always a very bad idea. Maybe if you are stuck in some kind of debugging hell where you basically want to add logging to std :: time, but you can't, then you should think about it. Otherwise, do not go there. If you want to test any code to check whether it works at different times, then pass this code to the parameter (or template parameter) that determines which time function it should call.
source share