设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1994|回复: 0

以不同的时间格式显示仿真时间

[复制链接]
发表于 2008-9-15 12:55:48 | 显示全部楼层 |阅读模式
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 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2024-6-16 01:46 , Processed in 0.011951 second(s), 14 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表