Home All Groups Group Topic Archive Search About

set up timer start 15 sec past minute

Author
17 Jul 2006 9:25 PM
martin1
Hi, All,

My question is how to set up timer start 15 sec past minute. It always start
15
sec past minute. For example, if current time is 8:30:45, the timer starts on
8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15; if
current time is 8:55:15, the timer starts on 8:55:15, if current time is
8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts 15
seconds  past minute, can anyone help this out?

Thanks in advance

Author
17 Jul 2006 11:32 PM
GhostInAK
Hello martin1,

why not just have yer timer fire every half second and the first thing you
check is the current time.

-Boo

Show quoteHide quote
> Hi, All,
>
> My question is how to set up timer start 15 sec past minute. It always
> start 15 sec past minute. For example, if current time is 8:30:45, the
> timer starts on 8:31:15 am; if current time is 8:00:00, the timer
> starts on 8:00:15; if current time is 8:55:15, the timer starts on
> 8:55:15, if current time is 8:59:00, the timer starts on 8:59:15 ...,
> so the timer always starts 15 seconds  past minute, can anyone help
> this out?
>
> Thanks in advance
>
Author
18 Jul 2006 4:48 AM
Cor Ligthert [MVP]
Martin,

What timer are you using?

There are at least three in System.Net

Cor

Show quoteHide quote
"martin1" <mart***@discussions.microsoft.com> schreef in bericht
news:C94FA0DA-50B8-430B-AA3B-A7322ED66E9C@microsoft.com...
> Hi, All,
>
> My question is how to set up timer start 15 sec past minute. It always
> start
> 15
> sec past minute. For example, if current time is 8:30:45, the timer starts
> on
> 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15; if
> current time is 8:55:15, the timer starts on 8:55:15, if current time is
> 8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts 15
> seconds  past minute, can anyone help this out?
>
> Thanks in advance
>
>
Author
18 Jul 2006 1:29 PM
martin1
Hi, Cor,

I use form timer (System.Windows.Forms.Timer), any more advice?

Thanks

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Martin,
>
> What timer are you using?
>
> There are at least three in System.Net
>
> Cor
>
> "martin1" <mart***@discussions.microsoft.com> schreef in bericht
> news:C94FA0DA-50B8-430B-AA3B-A7322ED66E9C@microsoft.com...
> > Hi, All,
> >
> > My question is how to set up timer start 15 sec past minute. It always
> > start
> > 15
> > sec past minute. For example, if current time is 8:30:45, the timer starts
> > on
> > 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15; if
> > current time is 8:55:15, the timer starts on 8:55:15, if current time is
> > 8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts 15
> > seconds  past minute, can anyone help this out?
> >
> > Thanks in advance
> >
> >
>
>
>
Author
18 Jul 2006 3:14 PM
Cor Ligthert [MVP]
Martin,

Than you can in my idea set the milliseconds after that you have extracted
the seconds (not the milliseconds) for that from the datetime.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformstimerclassintervaltopic.asp

http://msdn2.microsoft.com/en-us/library/system.datetime.second.aspx

Your maximum is in my idea 60 *1000.

I hope this helps,

Cor




Show quoteHide quote
"martin1" <mart***@discussions.microsoft.com> schreef in bericht
news:8913EAB2-F7A6-4136-8D9E-870F042A7967@microsoft.com...
> Hi, Cor,
>
> I use form timer (System.Windows.Forms.Timer), any more advice?
>
> Thanks
>
> "Cor Ligthert [MVP]" wrote:
>
>> Martin,
>>
>> What timer are you using?
>>
>> There are at least three in System.Net
>>
>> Cor
>>
>> "martin1" <mart***@discussions.microsoft.com> schreef in bericht
>> news:C94FA0DA-50B8-430B-AA3B-A7322ED66E9C@microsoft.com...
>> > Hi, All,
>> >
>> > My question is how to set up timer start 15 sec past minute. It always
>> > start
>> > 15
>> > sec past minute. For example, if current time is 8:30:45, the timer
>> > starts
>> > on
>> > 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15; if
>> > current time is 8:55:15, the timer starts on 8:55:15, if current time
>> > is
>> > 8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts
>> > 15
>> > seconds  past minute, can anyone help this out?
>> >
>> > Thanks in advance
>> >
>> >
>>
>>
>>
Author
18 Jul 2006 9:28 PM
martin1
Thank you. Cor,

So the logic is retrive current second, if = 15 sec, then start timer

The code look likes:

Dim moment As New System.DateTime
Private Shared myTimer As New System.Windows.Forms.Timer()

Dim second As Integer = moment.Second

if second = 20 then
       myTimer.Interval = 60000
       myTimer.Start()
end if

Is this correct?

Thanks,



Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Martin,
>
> Than you can in my idea set the milliseconds after that you have extracted
> the seconds (not the milliseconds) for that from the datetime.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformstimerclassintervaltopic.asp
>
> http://msdn2.microsoft.com/en-us/library/system.datetime.second.aspx
>
> Your maximum is in my idea 60 *1000.
>
> I hope this helps,
>
> Cor
>
>
>
>
> "martin1" <mart***@discussions.microsoft.com> schreef in bericht
> news:8913EAB2-F7A6-4136-8D9E-870F042A7967@microsoft.com...
> > Hi, Cor,
> >
> > I use form timer (System.Windows.Forms.Timer), any more advice?
> >
> > Thanks
> >
> > "Cor Ligthert [MVP]" wrote:
> >
> >> Martin,
> >>
> >> What timer are you using?
> >>
> >> There are at least three in System.Net
> >>
> >> Cor
> >>
> >> "martin1" <mart***@discussions.microsoft.com> schreef in bericht
> >> news:C94FA0DA-50B8-430B-AA3B-A7322ED66E9C@microsoft.com...
> >> > Hi, All,
> >> >
> >> > My question is how to set up timer start 15 sec past minute. It always
> >> > start
> >> > 15
> >> > sec past minute. For example, if current time is 8:30:45, the timer
> >> > starts
> >> > on
> >> > 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15; if
> >> > current time is 8:55:15, the timer starts on 8:55:15, if current time
> >> > is
> >> > 8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts
> >> > 15
> >> > seconds  past minute, can anyone help this out?
> >> >
> >> > Thanks in advance
> >> >
> >> >
> >>
> >>
> >>
>
>
>
Author
19 Jul 2006 5:12 AM
Cor Ligthert [MVP]
Martin,

No of course not. Something as


> Dim moment As New System.DateTime
> Private Shared myTimer As New System.Windows.Forms.Timer()
>
> Dim second As Integer = moment.Second
>
if second < 16 then
       myTimer.Interval = Cint(14 * 1000)
else
       myTimer.Interval = CInt(second * 1000)
end if
myTimer.Start()

I did not check this, but something as this,

Cor
Author
19 Jul 2006 4:23 PM
martin1
Hi, Cor,

the timer interval = 60 sec (60000milSec), I want timer starts 15 sec past
minute no matter when start the application, the app has the timer to refresh
data. so how to change the code? Thanks

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Martin,
>
> No of course not. Something as
>
>
> > Dim moment As New System.DateTime
> > Private Shared myTimer As New System.Windows.Forms.Timer()
> >
> > Dim second As Integer = moment.Second
> >
>  if second < 16 then
>        myTimer.Interval = Cint(14 * 1000)
> else
>        myTimer.Interval = CInt(second * 1000)
> end if
> myTimer.Start()
>
> I did not check this, but something as this,
>
> Cor
>
>
>
Author
19 Jul 2006 12:42 AM
Michael D. Ober
To get 15 seconds after midnight, use the following

Dim ts As TimeSpan = Now.Date.AddDays(1).AddSeconds(15) - Now

All the timer controls in dotNet can set their interval using a timespan
object.

Mike Ober.


Show quoteHide quote
"martin1" <mart***@discussions.microsoft.com> wrote in message
news:8913EAB2-F7A6-4136-8D9E-870F042A7967@microsoft.com...
> Hi, Cor,
>
> I use form timer (System.Windows.Forms.Timer), any more advice?
>
> Thanks
>
> "Cor Ligthert [MVP]" wrote:
>
> > Martin,
> >
> > What timer are you using?
> >
> > There are at least three in System.Net
> >
> > Cor
> >
> > "martin1" <mart***@discussions.microsoft.com> schreef in bericht
> > news:C94FA0DA-50B8-430B-AA3B-A7322ED66E9C@microsoft.com...
> > > Hi, All,
> > >
> > > My question is how to set up timer start 15 sec past minute. It always
> > > start
> > > 15
> > > sec past minute. For example, if current time is 8:30:45, the timer
starts
> > > on
> > > 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15;
if
> > > current time is 8:55:15, the timer starts on 8:55:15, if current time
is
> > > 8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts
15
> > > seconds  past minute, can anyone help this out?
> > >
> > > Thanks in advance
> > >
> > >
> >
> >
> >
Author
19 Jul 2006 4:26 PM
martin1
HI, Mike,

how to set 15 sec past minute no matter when the app starts, Thanks

Show quoteHide quote
"Michael D. Ober" wrote:

> To get 15 seconds after midnight, use the following
>
> Dim ts As TimeSpan = Now.Date.AddDays(1).AddSeconds(15) - Now
>
> All the timer controls in dotNet can set their interval using a timespan
> object.
>
> Mike Ober.
>
>
> "martin1" <mart***@discussions.microsoft.com> wrote in message
> news:8913EAB2-F7A6-4136-8D9E-870F042A7967@microsoft.com...
> > Hi, Cor,
> >
> > I use form timer (System.Windows.Forms.Timer), any more advice?
> >
> > Thanks
> >
> > "Cor Ligthert [MVP]" wrote:
> >
> > > Martin,
> > >
> > > What timer are you using?
> > >
> > > There are at least three in System.Net
> > >
> > > Cor
> > >
> > > "martin1" <mart***@discussions.microsoft.com> schreef in bericht
> > > news:C94FA0DA-50B8-430B-AA3B-A7322ED66E9C@microsoft.com...
> > > > Hi, All,
> > > >
> > > > My question is how to set up timer start 15 sec past minute. It always
> > > > start
> > > > 15
> > > > sec past minute. For example, if current time is 8:30:45, the timer
> starts
> > > > on
> > > > 8:31:15 am; if current time is 8:00:00, the timer starts on 8:00:15;
> if
> > > > current time is 8:55:15, the timer starts on 8:55:15, if current time
> is
> > > > 8:59:00, the timer starts on 8:59:15 ...,  so the timer always starts
> 15
> > > > seconds  past minute, can anyone help this out?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > >
>
>
>
>