It seems that if I want to display the "Time of Last Tick" to the second, I must use a Date() object. The short cut getSeconds() is still not working.
(This allows me to use seconds data from the system clock, and most of the time a new bar starts within one second of the system clock rolling to the next minute, so it works well enough to be useful.)
===
In your Help article about the Date() object you warn that it is a resource hog.
So when I first tried this I created the Date object with the other global variables (outside of any function) hoping to avoid creating more than one object. It worked just fine.
Then, as I added more stuff to my program, I reached a point where the seconds part of the display froze (at 44, if it matters). Hours and minutes (using the short cut functions) continued to update as expected.
After tinkering with is for a while, I found that if I moved the object creation code into main, the seconds part of my display began to function again.
Q1) Can anyone explain this change of behavior?
===
I'm beginning to see some sluggishness in the initial load of my program now. Once into real time operation, however, it seems to be able to keep up.
I've added lots of other stuff besides the date object, so some of the sluggishness could have other causes.
This is the code I'm using now for getting my "Time of Last Tick" data , and it runs on each new tick.
Q2) Any suggestions about a better way to do this?
Q3) Am I creating an additional object on each tick?
===
Q4) Is there a way to tell how many objects a program is actually creating?
Q5) Is there a way to destroy objects that are no longer needed?
(This allows me to use seconds data from the system clock, and most of the time a new bar starts within one second of the system clock rolling to the next minute, so it works well enough to be useful.)
===
In your Help article about the Date() object you warn that it is a resource hog.
So when I first tried this I created the Date object with the other global variables (outside of any function) hoping to avoid creating more than one object. It worked just fine.
Then, as I added more stuff to my program, I reached a point where the seconds part of the display froze (at 44, if it matters). Hours and minutes (using the short cut functions) continued to update as expected.
After tinkering with is for a while, I found that if I moved the object creation code into main, the seconds part of my display began to function again.
Q1) Can anyone explain this change of behavior?
===
I'm beginning to see some sluggishness in the initial load of my program now. Once into real time operation, however, it seems to be able to keep up.
I've added lots of other stuff besides the date object, so some of the sluggishness could have other causes.
This is the code I'm using now for getting my "Time of Last Tick" data , and it runs on each new tick.
Code:
var today = new Date(); // var Hr = getHour(0); var Min = getMinute(0); var Sec = today.getSeconds();
Q3) Am I creating an additional object on each tick?
===
Q4) Is there a way to tell how many objects a program is actually creating?
Q5) Is there a way to destroy objects that are no longer needed?
Comment