I want to add some codes in solar.cpp. I need to get the clock (current simulation time in second, min, hour, day, month, year like a time stamp) in the codes. What is the piece of code (or function) which I need to convert t0 (number of second elapsed since epoch) to time stamp format?
There are a couple of options.
The one I use a lot is to convert the time to a structure (a good example is in the triplex meter):
// then you can access it by
double my_day = my_time.day;
// and convert it back to epoch time
TIMESTAMP next_time = gl_mktime(&my_time);
but there are a number of other options (gl_parsetime, gl_printtime, gl_strtime, gl_todays, etc.) Most of these are documented on the WIKI, but definitely not all. All of the available time handling functions can be found in ../core/gridlabd.h; search for the header "Timestamp handling"
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.