Announcement

Collapse
No announcement yet.

getTime() and getSecond()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • getTime() and getSecond()

    I have been trying to understand these functions so that I can implement a count down timer on my charts that works in both real time and playback.

    It appears that the getTime function is using the real time clock and not the tick data stream and the getSeconds always returns zero in Playback.

    Is there anyway to use the raw time embedded in the tick data to access the seconds remaining in the bar?

  • #2
    you might try this...

    PHP Code:
    var vHour;
    var 
    vMin;
    var 
    vSec;
    var 
    vDay;
    var 
    vMonth;
    var 
    vYear;
    var 
    vTime = new Date();


    function 
    main() {

    //---------------------------------------------------
    //  Get Time Variables
      
    vTime getValue("Time", );
      
    vHour vTime.getHours();
      
    vMin vTime.getMinutes();
      
    vSec vTime.getSeconds();
      
    vDay vTime.getDate();
      
    vMonth vTime.getMonth() +1;
      
    vYear vTime.getYear();
    //---------------------------------------------------

    debugPrintln(vHour+":"+vMin+":"+vSec);

    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Yes, That's exactly what I am doing and in Playback seconds is always zero. Can anyone tell me why or how to get seconds?

      Comment


      • #4
        When you are in playback, you must get the time associated with the bar.

        var vHour = getHour();
        var vMin = getMinute();
        var vSec = getSecond();
        var vSecT = vSec+60*vMin +3600*vHour;
        var vHMS = vHour+":"+vMin+":"+vSec;
        var vMillisecond = getValue("rawtime");
        var vDay = getDay();
        var vMonth = getMonth();
        var vYear = getYear();

        These should work to give you the actual time associated with the new bars coming in. (not tick)

        here is a link to time for you to look at.

        Brad provided you the commands for clock time which will get the elapsed time you asked about. This is the only thing that can get you to an elapsed timer feature. The only way you could get that to work is if you played back at 1.0 speed. Any higher speed would mess up the time ratio.

        The commands I provided will give you the timestamp associated with each bar.

        If you open up the data file you are using for tick playback, it may provide some insight as to the data available to manipulate in tick playback.

        Comment


        • #5
          I guess I'm really dense. I'm sure I'll figure it out eventually, if I write enough debegprint statements to cover every possible combination, but can someone please flowchart for me the method for extracting time data and the source of the data, so that I can understand how to fully utilize it.

          As I see it, whether in Playback or Real time we only have 2 sources for the data, the computers real time clock, and the data either coming from the real time data stream through the data manager, or the tick file. But if I understand you correctly, these time access methods can access a database of bar data which creates a 3rd source, Also apparently the way this data is extracted is handled differently with playback then real time, so lets take it one case at a time.

          First, as I understand it, there are 3 methods of retrieving the time data using efs,

          1. The gethour, getminute, getsecond method, so if this is accessing bar time then getting 0 for getseconds just means that the bar started at 0 seconds? Then the getValue("rawtime"); method would get me seconds within the bar, coming from the data source, but not the playback tick data? If it does access the tick data which I think you're saying it doesn't, how would I convert the barstart time from getminute, etc above to convert to raw time?

          2. The getValue("Time", ); method.. If I understand correctly, this will get me the CPU system clock time? Here again I am perplexed about how to determine the start of bar time in the proper format to achieve an elapsed time?

          3. the getTime() method, which I'm not sure how it is different.

          I'd really appreciate any help anyone can give me to explain the source of each method in both real time and playback.

          Thanks.

          Comment


          • #6
            Do you have the help file for efs? Chris Kryza maintains the most recent copy of it for eSignal. What I do is install it and keep it available while I am coding.

            If that is not sufficient, I have a time efs of which I had provided a snippet in the previous post. It is one of my older ones, but it works and it is what I use to obtain time in either normal or playback mode.

            To try and answer your questions,

            1. The gethour, getminute, getsecond method, so if this is accessing bar time then getting 0 for getseconds just means that the bar started at 0 seconds? Then the getValue("rawtime"); method would get me seconds within the bar, coming from the data source, but not the playback tick data? If it does access the tick data which I think you're saying it doesn't, how would I convert the barstart time from getminute, etc above to convert to raw time?
            I have not tried getting seconds info for tick playback data, I think you will only get information from the beginning of the bar if using the methods in the first sentence. elapsed time would have to be clock time using the date object.

            2. The getValue("Time", ); method.. If I understand correctly, this will get me the CPU system clock time? Here again I am perplexed about how to determine the start of bar time in the proper format to achieve an elapsed time?
            I am not sure, I would have to test it myself. If I were to perform an in-depth test as you are discussing, I would incorporate my trace application which outputs data to a file.

            3. the getTime() method, which I'm not sure how it is different.
            This method is part of the date object

            var today = new Date();

            var h = today.getTime();

            Comment


            • #7
              Steve,

              Yes, I do have the help file and I have search the web site as well, but as far as I can tell none of it answers the questions I have been asking.

              Thanks for the Time efs and the trace application, haven't used them yet, but I'm sure they'll come in handy.

              After much consideration, the data I really need to solve this problem is the time associated with each tick, and I can see that data in the tick stream, but if I understand correctly, there is no way to access this data. Is that correct?

              Anything else I ultimately do will only be an approximation if I can't access the tick time stamps.

              Thanks again for the help.

              Comment


              • #8
                Hello Snickers,

                The tick time stamp from the tick replay files are not accessible through EFS currently.
                Jason K.
                Project Manager
                eSignal - an Interactive Data company

                EFS KnowledgeBase
                JavaScript for EFS Video Series
                EFS Beginner Tutorial Series
                EFS Glossary
                Custom EFS Development Policy

                New User Orientation

                Comment


                • #9
                  Jason,

                  Thanks. Isn't it also true that the tick time stamp data is not available in real time either? If it is available, which method gives one this data?

                  Comment


                  • #10
                    Hello Snickers,

                    Correct. At least not the official time stamp from the feed. But you could use a date object to create a time stamp in real time.
                    Jason K.
                    Project Manager
                    eSignal - an Interactive Data company

                    EFS KnowledgeBase
                    JavaScript for EFS Video Series
                    EFS Beginner Tutorial Series
                    EFS Glossary
                    Custom EFS Development Policy

                    New User Orientation

                    Comment


                    • #11
                      Re:replay time stamps

                      Jason,

                      Are the replay time stamps available by DDE?

                      Regards,
                      Espi.

                      -----------------------------------------------------------------------------
                      Hello Snickers,

                      The tick time stamp from the tick replay files are not accessible through EFS currently.


                      __________________
                      Jason K.
                      EFS Support Specialist
                      eSignal____________

                      Comment


                      • #12
                        Hello espi1,

                        The tick time stamp from the tick replay files are not accessible through EFS so you won't be able to create a DDE link through an EFS file either.
                        Jason K.
                        Project Manager
                        eSignal - an Interactive Data company

                        EFS KnowledgeBase
                        JavaScript for EFS Video Series
                        EFS Beginner Tutorial Series
                        EFS Glossary
                        Custom EFS Development Policy

                        New User Orientation

                        Comment

                        Working...
                        X