ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
clock shows wrong time
Hi I´ve got a clock included in one of my bigger modells and it started to Show this times.
What am I doing wrong?
__________________
Hemmi |
#4
|
||||
|
||||
Please send a model showing the issue to Support using www.flexsim.com/support so that we can figure out what is happening.
|
#5
|
||||
|
||||
Thanks Phil, I did so. But I also can share the example here, because it doesn´t work for new models.
Maybe this problem doesn´t appear at other systems?
__________________
Hemmi |
#6
|
||||
|
||||
There is a small bug in the code for "none format" time. The start time will added after the calculation of the time string
This code should solve your problem (changes are in bold letters): Code:
treenode current = ownerobject(c); treenode textnode = parnode(1); /***popup:DisplayDateTime*/ /**Display Date and Time*/ #define formatNone 0 #define formatDefault 1 #define formatCustom 2 int format = /** \nUSe Default Format: *//***tag:format*//**/formatNone/**list:formatNone~formatDefault~formatCustom*/; switch (format) { case formatNone: double modelunit = getmodelunitnum(TIME_MULTIPLE); double timeinseconds = time() * modelunit; timeinseconds += getmodelunitnum(START_SECOND); timeinseconds += getmodelunitnum(START_MINUTE)*60; timeinseconds += getmodelunitnum(START_HOUR)*3600; int cumulative = 0; int daynumber = (timeinseconds / (3600 * 24)) + 1; cumulative += (daynumber-1) * 3600 * 24; int hournumber = (timeinseconds - cumulative) / 3600; cumulative += hournumber * 3600; int minutenumber = (timeinseconds - cumulative) / 60; cumulative += minutenumber * 60; int secondnumber = timeinseconds - cumulative; /*The code inside this comment should be removed. hournumber += getmodelunitnum(START_HOUR); minutenumber += getmodelunitnum(START_MINUTE); secondnumber += getmodelunitnum(START_SECOND);*/ string hourstring = numtostring(hournumber,0,0); string minutestring = numtostring(minutenumber,0,0); string secondstring = numtostring(secondnumber,0,0); if (hournumber < 10) hourstring = concat("0", hourstring); if (minutenumber < 10) minutestring = concat("0", minutestring); if (secondnumber < 10) secondstring = concat("0", secondstring); string timetext = concat("Day ", numtostring(daynumber,0,0),", ", hourstring,":", minutestring,":", secondstring); setnodestr(textnode, timetext); break; case formatDefault: setnodestr(textnode, getmodelunitstr(CURRENT_TIME)); break; case formatCustom: string timeformat = /** \nTime Format: *//***tag:timeformat*//**/"h:mm:ss tt"/**/; string dateformat = /** \nDate Format: *//***tag:dateformat*//**/"ddd d MMM yyyy"/**/; applicationcommand("convertunixtime", tonum(textnode), getmodelunitnum(CURRENT_TIME), timeformat, dateformat); break; } |
The Following 5 Users Say Thank You to Carsten Seehafer For This Useful Post: | ||
Tom David (01-07-2014) |
Thread | Thread Starter | Forum | Replies | Last Post |
Sketchup model shows wrong colors | Steven Hamoen | Q&A | 2 | 02-12-2013 06:32 AM |
Something wrong with my flexsim 5 | Hao Zhou | Q&A | 3 | 12-01-2011 10:30 AM |
Displaying simulation clock | Shankar Narayan | Q&A | 5 | 11-25-2011 01:32 PM |
Clock Overflow Flow Stopped Error Msg | shashanktrivedi | Q&A | 1 | 06-08-2011 08:24 PM |
Countdown clock | E.C.Ante | Q&A | 4 | 10-10-2007 04:27 AM |