Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Timer

Timer

Scheduled Pinned Locked Moved C#
question
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    levis
    wrote on last edited by
    #1

    Hi all!I have these two lines of codes in my program: float time = (float)DateTime.Now.Second; xyGraphControl1.AddPoint(time,power); The result of the codes is that the timer starts at the same second as the clock in my computer. How am I going to force the timer to always and only start at 0 second? Thank you very much!

    S 1 Reply Last reply
    0
    • L levis

      Hi all!I have these two lines of codes in my program: float time = (float)DateTime.Now.Second; xyGraphControl1.AddPoint(time,power); The result of the codes is that the timer starts at the same second as the clock in my computer. How am I going to force the timer to always and only start at 0 second? Thank you very much!

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      What timer? Please provide some more details (code) about what you're trying to do.


      www.troschuetz.de

      L 1 Reply Last reply
      0
      • S Stefan Troschuetz

        What timer? Please provide some more details (code) about what you're trying to do.


        www.troschuetz.de

        L Offline
        L Offline
        levis
        wrote on last edited by
        #3

        Actually this timer is act like a stop watch in my program..So when everytime i press start button it will start run from 0 seconds until i press stop button to stop it.Now the problem is when i press the start button it start according to my computer time(second). float time =(float)DateTime.Now.Second ; xyGraphControl1.AddPoint(time, power); long StartClock; private void StartButton_Click(objectsender,System.EventArgse) { timer1.Start(); // get the exact hour started in milliseconds StartClock = DateTime.Now.Ticks; xyGraphControl1.Reset(); } Thank very much!

        S 1 Reply Last reply
        0
        • L levis

          Actually this timer is act like a stop watch in my program..So when everytime i press start button it will start run from 0 seconds until i press stop button to stop it.Now the problem is when i press the start button it start according to my computer time(second). float time =(float)DateTime.Now.Second ; xyGraphControl1.AddPoint(time, power); long StartClock; private void StartButton_Click(objectsender,System.EventArgse) { timer1.Start(); // get the exact hour started in milliseconds StartClock = DateTime.Now.Ticks; xyGraphControl1.Reset(); } Thank very much!

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          levi`s wrote: float time =(float)DateTime.Now.Second ; xyGraphControl1.AddPoint(time, power); Ok, but what's with these lines of code? What should they do and in which context (method) do they stand?


          www.troschuetz.de

          L 1 Reply Last reply
          0
          • S Stefan Troschuetz

            levi`s wrote: float time =(float)DateTime.Now.Second ; xyGraphControl1.AddPoint(time, power); Ok, but what's with these lines of code? What should they do and in which context (method) do they stand?


            www.troschuetz.de

            L Offline
            L Offline
            levis
            wrote on last edited by
            #5

            the 1st line mean assign the time(second) in the my computer to float time and the 2nd mean add point to the graph with X-axis is time and Y-axis is power..So basically this AddPoint is add the point to the point to the graph

            S 1 Reply Last reply
            0
            • L levis

              the 1st line mean assign the time(second) in the my computer to float time and the 2nd mean add point to the graph with X-axis is time and Y-axis is power..So basically this AddPoint is add the point to the point to the graph

              S Offline
              S Offline
              Stefan Troschuetz
              wrote on last edited by
              #6

              I guessed that. But where is that code and what does it has to do with your timer?


              www.troschuetz.de

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups