Keeping track of time / two things at once - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Projects (http://qbasicnews.com/newforum/forum-12.html) +--- Thread: Keeping track of time / two things at once (/thread-1165.html) |
Keeping track of time / two things at once - Shaggy - 06-11-2003 I am writing a program that collects data for work. One item is the length of a call. The program will be running whether we are on the phone or not, so only part of it needs to keep track of time. So, here's the dilemma: how do I get part of the program to count the hours and/or minutes and/or seconds we are on the phone while still running the rest of the program? Shaggy Keeping track of time / two things at once - seph - 06-11-2003 Code: DO You can use that concept to get the seconds the phone call lasted. You can then manipulate the seconds to get minutes and hours, etc. Keeping track of time / two things at once - RST - 06-12-2003 You could do an event-tapping type thing where the program just loops until an event happens, like hanging up the phone or an employee checks in. Sort of like Seph said, except you put other stuff in the loop also. Another alternative would be to have seperate programs running at the same time. You can have them write to a file or use global vars if they need to communicate. Keeping track of time / two things at once - Shaggy - 06-12-2003 seph and RST, I tried the idea of a loop before. It didn't work. My program is just a giant loop made of lots of small ones. Putting another loop in it using TIMER (and looping it around several other loops) seemed to take up a lot of space for such a simple task. I was looking for a simpler way. I am actually writing two programs, one to write the data and one to read it. Perhaps I could just make the reader figure out the total time. Anyway, thanks for the help. Keep an eye out for later messages about the second program (the data reader). Shaggy Keeping track of time / two things at once - seph - 06-12-2003 The thing is, you treat my small loop as your large loop. Keeping track of time / two things at once - Shaggy - 06-13-2003 Quote:The thing is, you treat my small loop as your large loop. Actually, the things is, the timer loop in my project has to be set off by a keystroke (meaning I have to use a string). I get a type mismatch trying to use a string and an interger together, so your idea, although good, won't work in my program. To set off the timer loop with a string took me several more lines of code that returned 0 as the total time. If you can tell me how to get the program to set off the timer loop with a keystroke, and still return the actual time on the phone at the end (instead of 0, like my first idea did), it would be greatly appreciated. Shaggy Keeping track of time / two things at once - RST - 06-14-2003 Code: PRINT "Press a key to start timer..." Is this what you had in mind? If it is and you need help with any of it, just ask. Keeping track of time / two things at once - Shaggy - 06-14-2003 RST, FABULOUS! :bounce: Except I need to modify it a little to look for a specific keystroke to start and finish the call and put the start and finish in specific parts of the program... but, don't worry, I've got that covered. It didn't even occur to me to use a non-string non-integer (i.e. just StartTime instead of StartTime$ or StartTime%). Well, that's why I picked the signature I have. Shaggy |