TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
niketas
NA
1
0
Timer and DateTime — clock goes wrong
Apr 7 2008 6:11 PM
Greetings.
First of all, I'm very sorry for my English.
Trying to create my own virtual clock with a function of time-accelerating. I want clock hands to rotate smoothly, so to accelerate clock speed I managed to go on with timer this way: I set up a timer with an interval of 1 millisecond, and when timer ticks, this procedure helds:
private void timer1_Tick(object sender, System.EventArgs e)
{
s = (s + (double)hScrollBar1.Value / 100) % 60;
//hScrollBar1.Value is a coefficient of accelerating
}
So each 1 ms the
s
variable, responsible for seconds hand, increases by 0.01.
I have 2 questions:
1. When things go on like this, why there are 100 ms in a second instead of usual 1000?
2.
Important:
why clock is
late
approx. by 1.6 times to a usual DateTime clock when I use timer and timer_Tick inreasing of
s
(
h
,
m
,
ms
)
variable? E.g., in “my clock's world” passes only 40 seconds, while in real world 64 has gone.
Appreciate your input very much! Can provide source project at any time, please, explain and/or help.
Reply
Answers (
1
)
Leadership Opportunity in Biomedical Technologies field, CA
How to call a Stored Procedure?