Page 1 of 1
Get system time
Posted: Mon Mar 24, 2014 11:38 am
Is there any way to get the current time of the system from within the nrniv window? Something akin to localtime() in C?
Re: Get system time
Posted: Mon Mar 24, 2014 12:47 pm
hoc has a system() call but it its arguments and returned results are guaranteed to be non-portable because they depend on one's operating system. It is a bad idea to make one's code OS-dependent, because you will be creating future problems for any one who tries to reuse it under a different OS.
hoc also has startsw and stopsw, but the chief utility of those functions is for gauging software performance. If you're thinking about using those values as seeds for pseudorandom number generators, don't. That may be appropriate for a computer game, or for a demonstration program that produces flashy effects, but it's not a good idea for computational modeling--see this strong caveat.