设置计时器 [英] Setting a timer
问题描述
这比VB更合乎逻辑。
我遇到这种情况:
需要勾选每个计时器的计时器从第15分钟开始10分钟的时间
小时。
但是我想计算下一次打勾时间,每当我想开始时
计时器。
所以,我在25,35,45,55,05分钟有刻度
如果我启动计时器在第33分钟我需要2分钟的间隔,直到35
才能启动计时器..
在勾选事件时我将间隔重置为10分钟。
如何计算2分钟间隔?
-
干杯,
Crirus
------------------------------
如果工作很好事情,老板会把这一切都从你这里拿走
---------------------------- -
This is more a logical problem than a VB.
I have this situation:
A timer that need to tick at each 10 minutes starting on minute 15 of curent
hour.
But I want to calculate the next tick time whenever I want to start the
timer.
So, I have ticks on minutes 25, 35, 45, 55, 05
If I start the timer on minute 33 I need that 2 minutes interval untill 35
in order to start the timer..
On tick event I reset the interval to 10 minutes.
How to calculate that 2 minute interval?
--
Cheers,
Crirus
------------------------------
If work were a good thing, the boss would take it all from you
------------------------------
推荐答案
PSEUDO - 希望这会有所帮助 - 关心OHM#
Dim FirstTick As Boolean = True >
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval as Int32
而MinuteNow< 15
MinuteNow = TimeNow.GetMinute
循环
InterimInterval = 10 - (MinuteNow MOD 10)
设置定时器= InterimInterval
Sub On TimerTick
如果是FirstTick
设置定时器间隔= 10
FirstTick = False
结束如果
结束子
Crirus写道:
PSEUDO - Hope this helps - Regards OHM#
Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval As Int32
While MinuteNow < 15
MinuteNow = TimeNow.GetMinute
Loop
InterimInterval = 10 - ( MinuteNow MOD 10 )
Set Timer = InterimInterval
Sub On TimerTick
If FirstTick The
Set Timer Interval = 10
FirstTick = False
End If
End Sub
Crirus wrote:
这是一个比VB更合乎逻辑的问题。
我遇到这种情况:
一个计时器,需要在
当前的第15分钟开始每10分钟打勾。
但是我想随时计算下一个计时开始计时器。
所以,我在25分钟,35分钟,45分钟,55分钟,05分钟时打勾。
如果我在第33分钟开始计时器我需要2分钟间隔
直到35才能启动计时器。
在勾选事件时我将间隔重置为10分钟。
如何计算2分钟间隔?
This is more a logical problem than a VB.
I have this situation:
A timer that need to tick at each 10 minutes starting on minute 15 of
curent hour.
But I want to calculate the next tick time whenever I want to start
the timer.
So, I have ticks on minutes 25, 35, 45, 55, 05
If I start the timer on minute 33 I need that 2 minutes interval
untill 35 in order to start the timer..
On tick event I reset the interval to 10 minutes.
How to calculate that 2 minute interval?
问候 - OHM# On ******* ***@BTInternet.com
如果可能的话我会发表2条评论; p
1我认为时间永远不会得到一个新的值,所以循环永远不会结束(在while循环中更新
)
2看起来while循环将不停地运行,在while循环调用
doevents或睡眠
i不认为用户在13:01点击按钮时会很高兴和
必须等待14分钟才能完成他们的电脑工作
替代方案可以正常工作w 2计时器开始第一个用户
点击设置为间隔1分钟,MinuteNow <1分钟。 15到达
推出第二个10分钟的itervals并停止第一个。
希望它有帮助
单手人[OHM#] <有关********** @ BTInternet.com>在消息中写道
新闻:OF ************** @ TK2MSFTNGP12.phx.gbl ...
2 remarks if i may ;p
1 i think timenow never gets a new value so the loop will never end (update
it in the while loop)
2 it looks like the while loop will run non stop, in the while loop call
doevents or a sleep
i don''t think users would be happy when they click the button at 13:01 and
have to wait 14mins to do anithing w their pc
alternative could be working w 2 timers start the first one when the user
clicks set it for 1min intervals and when the MinuteNow < 15 is reached
launch the second one w 10min itervals and stop the first one.
hope it helps
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in message
news:OF**************@TK2MSFTNGP12.phx.gbl...
PSEUDO - 希望这会有所帮助 - 问候OHM#
Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval As Int32
MinuteNow< 15
MinuteNow = TimeNow.GetMinute
循环
InterimInterval = 10 - (MinuteNow MOD 10)
设置Timer = InterimInterval
Sub On TimerTick
如果FirstTick设置定时器间隔= 10
FirstTick = False
结束如果
End Sub
Crirus写道:
PSEUDO - Hope this helps - Regards OHM#
Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval As Int32
While MinuteNow < 15
MinuteNow = TimeNow.GetMinute
Loop
InterimInterval = 10 - ( MinuteNow MOD 10 )
Set Timer = InterimInterval
Sub On TimerTick
If FirstTick The
Set Timer Interval = 10
FirstTick = False
End If
End Sub
Crirus wrote:
这是一个比VB更合乎逻辑的问题。
>我遇到这种情况:
一个计时器,需要在每分钟10分钟开始计时。
但我想计算一下每当我想开始计时器的下一个滴答时间。
所以,我在分钟25,35,45,55,05上打勾
如果我开始分钟33上的计时器我需要2分钟间隔
直到35才能启动计时器..
在勾选事件时我将间隔重置为10分钟。
如何计算2分钟间隔?
This is more a logical problem than a VB.
I have this situation:
A timer that need to tick at each 10 minutes starting on minute 15 of
curent hour.
But I want to calculate the next tick time whenever I want to start
the timer.
So, I have ticks on minutes 25, 35, 45, 55, 05
If I start the timer on minute 33 I need that 2 minutes interval
untill 35 in order to start the timer..
On tick event I reset the interval to 10 minutes.
How to calculate that 2 minute interval?
问候 - OHM# On**********@BTInternet.com
这是未经测试的PSEUDO代码。即使语法
不正确,意图也很明确。当我写''Actual''代码时,你可以回来批评我
OK
将其替换为。 。作为PSEUDO
而MinuteNow< 15
MinuteNow = Now.GetMinute
循环
OHM#
EricJ写道:
This was untested PSEUDO Code. The intention is clear even if the syntax is
not correct. When I write ''Actual'' code, you can come back and criticise me
OK
Replace this with . . As PSEUDO
While MinuteNow < 15
MinuteNow = Now.GetMinute
Loop
OHM#
EricJ wrote:
2备注,如果我可以; p
1我认为timenow永远不会得到一个新值,所以循环永远不会结束
(在此期间更新它循环)
2看起来while循环会不停地运行,在while循环中调用doevents或者睡觉
我不认为用户会很开心他们点击了13:01的按钮,并且必须等待14分钟来完成他们的电脑。
替代方案可以正常工作w 2计时器启动第一个用户点击
将其设置为1分钟间隔,并且当MinuteNow <1时。 15是推出第二个w 10分钟的itervals并停止第一个。
希望它有帮助
一手人[OHM#] <有关********** @ BTInternet.com>在
消息新闻中写道:OF ************** @ TK2MSFTNGP12.phx.gbl ...
2 remarks if i may ;p
1 i think timenow never gets a new value so the loop will never end
(update it in the while loop)
2 it looks like the while loop will run non stop, in the while loop
call doevents or a sleep
i don''t think users would be happy when they click the button at
13:01 and have to wait 14mins to do anithing w their pc
alternative could be working w 2 timers start the first one when the
user clicks set it for 1min intervals and when the MinuteNow < 15 is
reached launch the second one w 10min itervals and stop the first one.
hope it helps
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in
message news:OF**************@TK2MSFTNGP12.phx.gbl...
PSEUDO - 希望这会有所帮助 - 关心OHM#
Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval as Int32
<当MinuteNow< 15
MinuteNow = TimeNow.GetMinute
循环
InterimInterval = 10 - (MinuteNow MOD 10)
设置Timer = InterimInterval
Sub On TimerTick
如果FirstTick设置定时器间隔= 10
FirstTick = False
结束如果
End Sub
Crirus写道:
PSEUDO - Hope this helps - Regards OHM#
Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval As Int32
While MinuteNow < 15
MinuteNow = TimeNow.GetMinute
Loop
InterimInterval = 10 - ( MinuteNow MOD 10 )
Set Timer = InterimInterval
Sub On TimerTick
If FirstTick The
Set Timer Interval = 10
FirstTick = False
End If
End Sub
Crirus wrote:
这是一个比VB更合乎逻辑的问题。
>我遇到这种情况:
一个计时器,需要在每分钟10分钟开始计时15分钟。
但我想计算一下每当我想开始计时器的下一个滴答时间。
所以,我在分钟25,35,45,55,05上打勾
如果我开始分钟33上的计时器我需要2分钟间隔
直到35才能启动计时器..
在勾选事件时我将间隔重置为10分钟。
如何计算2分钟间隔?
This is more a logical problem than a VB.
I have this situation:
A timer that need to tick at each 10 minutes starting on minute 15
of curent hour.
But I want to calculate the next tick time whenever I want to start
the timer.
So, I have ticks on minutes 25, 35, 45, 55, 05
If I start the timer on minute 33 I need that 2 minutes interval
untill 35 in order to start the timer..
On tick event I reset the interval to 10 minutes.
How to calculate that 2 minute interval?
问候 - OHM# On**********@BTInternet.com
问候 - OHM# On ****** ****@BTInternet.com
这篇关于设置计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!