Computing.Net > Forums > Programming > QBasic Time clock programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

QBasic Time clock programming

Reply to Message Icon

Name: Matt
Date: January 25, 2002 at 20:18:09 Pacific
Comment:

I have been given an assignment by my school to create a program where users clock in and clock out. Right now, the system just records the time and date that they punched in/out and I need a way of determining the length of time that they worked. Any examples would be very much appreciated as it is due very very soon.



Sponsored Link
Ads by Google

Response Number 1
Name: James
Date: January 27, 2002 at 01:31:27 Pacific
Reply:

I'm not sure if I'm reading you correctly but if I am this is what you need to do: (this method is inefficient but simple)

Convert the year month and day to days past 2002 for both dayin and dayout.
Get the difference (DIFF1) in these values which gives you the days that the user was logged in.
eg.
IN: 5/2/2002
OUT: 5/3/2002
5 (day 5) + 31 (january) + 0 (2002)
5 (day 5) + 31+28 (january+february)+0(2002)
DIFF1 = 28 days

There are many other ways that are more efficient to do the day difference but that would require a bit more complicated math.

Then if the time is recorded in seconds past midnight (don't remember how Qbasic records time)
Get the difference between these (DIFF2).

Therefore the user was logged in for DIFF1 days and DIFF2 seconds.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: QBasic Time clock programming

Time alarm program in windows www.computing.net/answers/programming/time-alarm-program-in-windows/2309.html

timed batch program www.computing.net/answers/programming/timed-batch-program/17606.html

c application time clock inserting www.computing.net/answers/programming/c-application-time-clock-inserting/8776.html