Displaying the simulation time with the various date/time formats. 这可以通过设置visual tool来实现。设置如下:VisualTool object/display text/Text Display:Text Display
计算‘星期’和‘天’,代码如下:
double startTime = 0;
int week = (time()-startTime)/7/24/3600;
int day = (time()-startTime-7*24*3600*week)/24/3600;
显示“星期”和“天”,代码如下:
treenode current = ownerobject(c);
treenode textnode = parnode(1);/**Display Time. Format - Week w, Day d*/
double startTime = 0;
int week = (time()-startTime)/7/24/3600;
int day = (time()-startTime-7*24*3600*week)/24/3600;
string timetext =
concat(
"Week ",
numtostring(week,0,0),", Day ",
numtostring(day,0,0)
);
setnodestr(textnode, timetext);
[ 本帖最后由 ned0 于 2008-9-15 13:09 编辑 ] |