473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Time outs

Lou
How can i do a time out based on seconds or milliseconds.
I need to exit loops based on a time value.

The VB6 equiv is:

Dim markTime As Date
marktime=Now
If DateDiff("s",markTime,Now).2 then exit do

Thanks
-Lou
Nov 15 '05 #1
3 1291
You can do it the same way, if that's how it has to be
done:

DateTime markTime = DateTime.Now;
do{
if(DateDiff("s",markTimer,DateTime.Now) >= 2){
break;
}

// some code...

} while(...);
If you want your timeout to be EXACT, I'd use threading
and abort your thread when a specific time period elapses.
JER
-----Original Message-----
How can i do a time out based on seconds or milliseconds.
I need to exit loops based on a time value.

The VB6 equiv is:

Dim markTime As Date
marktime=Now
If DateDiff("s",markTime,Now).2 then exit do

Thanks
-Lou
.

Nov 15 '05 #2
Lou
Can you show an example?

"Jerry Negrelli" <je************@removethispartdatascientific.com > wrote in
message news:00****************************@phx.gbl...
You can do it the same way, if that's how it has to be
done:

DateTime markTime = DateTime.Now;
do{
if(DateDiff("s",markTimer,DateTime.Now) >= 2){
break;
}

// some code...

} while(...);
If you want your timeout to be EXACT, I'd use threading
and abort your thread when a specific time period elapses.
JER
-----Original Message-----
How can i do a time out based on seconds or milliseconds.
I need to exit loops based on a time value.

The VB6 equiv is:

Dim markTime As Date
marktime=Now
If DateDiff("s",markTime,Now).2 then exit do

Thanks
-Lou
.

Nov 15 '05 #3
Hmm, off the top of my head this is one way to do that;
there are many ways...

using System.Threading;

//...code omitted...
public void ExampleMethod1(){
Thread myEvilThread = new Thread(new ThreadStart
(ExampleMethod2));
myEvilThread.Start();
System.Threading.Thread.Sleep(2000); //pause 2 seconds
myEvilThread.Abort();
}

public void ExampleMethod2(){
//...do some stuff
}
JER
-----Original Message-----
Can you show an example?

"Jerry Negrelli" <je************@removethispartdatascientific.com > wrote inmessage news:00****************************@phx.gbl...
You can do it the same way, if that's how it has to be
done:

DateTime markTime = DateTime.Now;
do{
if(DateDiff("s",markTimer,DateTime.Now) >= 2){
break;
}

// some code...

} while(...);
If you want your timeout to be EXACT, I'd use threading
and abort your thread when a specific time period elapses.

JER
>-----Original Message-----
>How can i do a time out based on seconds or milliseconds. >I need to exit loops based on a time value.
>
>The VB6 equiv is:
>
>Dim markTime As Date
>marktime=Now
>If DateDiff("s",markTime,Now).2 then exit do
>
>Thanks
>-Lou
>
>
>.
>

.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jerry | last post by:
Hi All ! Could somebody help me out on this one: My script needs to execute a time consuming process which might take as long as an hour or so to finish. Usually, the time limit would produce...
3
by: bigoxygen | last post by:
Hi. My Web application contains a csv export function. This function exports a lot of data, and it should take up to 2 minutes. However, I think the "loading time limit" is 30 seconds or so. ...
3
by: Jim Geissman | last post by:
The C++ application calls the database to look up property data. One troublesome query is a function that returns a table, finding data which is assembled from four or five tables through a view...
1
by: siliconmike | last post by:
I'm using apache+php I'm trying to understand how various timeouts work and where are the settings.. Lets say a web browser requests page index.php which does some long processing. When...
2
by: Ebrahim | last post by:
Hello NG I’m developing software for my hardware which is connected via USB to my computer, I already have written the necessary firmware and a mini driver (by Windws2000 DDK) which both works ...
0
by: Bill Borg | last post by:
Hello all, I need to know the local time for users of a global system. Here's the scenario: My server (PDT time) hosts commerce for companies around the world. It's fair to assume that those...
3
by: DotNetGuy | last post by:
I have been programming in asp.net w/ vb for 3 years now and I feel a need to include more client side script with javascript so here I am. Hopefully in the right place. I have a timecard web app...
5
by: cvisal | last post by:
Hi all Im working on productivity calculations (Time calculations) and need some help in coding. Database Tool:MS-Access 2003. The general operator punch-in time is 5:30 AM and the punch-out...
2
by: Richard | last post by:
Hello all, I am looking into issues with time-outs on a website. These appear to happen in a random way for some users. This is one example: Fatal error: Maximum execution time of 60 seconds...
5
by: Charles May | last post by:
Anyone have a simple concept for the best way to store timeclock information in a database. I currently have my table set up like this with a typical daily entry. tcID empID Type ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.