time

For simple C cmd programs: how to add "program executed in 12,345 seconds" ?

I'm a windows user, and I'm learning C. I use Codeblocks and visual c++ 2008 express at home to write simple C command line programs (I'm a beginner) and I find really useful when codeblocks adds a few lines at the end with the time it takes (example: "Process returned 0 (0x0) execution time : 6.848 s"). I want to add this functionali...

How can I repeat something for x minutes in Python?

I have a program (temptrack) where I need to download weather data every x minutes for x amount of hours. I have figured out how to download every x minutes using time.sleep(x*60), but I have no clue how to repeat this process for a certain amount of hours. UPDATE: Thank you to everyone who posted a solution. I marked the example using ...

notification scheduling question

Hi Stackers! I'm building an app that needs to send out notifications to users depending on user definable "notifications". So the notifications are not per event. They are arbitrary. A cron job should query the database and send out emails when it finds an event with matching criterion. The is a scheduling app. So naturally, one of th...

What time corresponds to : time()-24*60*60 ? (PHP)

Hello, just a quick question, What time corresponds to : time()-24*60*60 ? (PHP) 7 days ? is that right ? Thanks ! ...

Python run command line (time)

Hi, I want to run the 'time' unix command from a Python script, to time the execution of a non Python app. I would use the os.system method. Is there any way to save the output of this in Python? My goal is to run the app several times, save their execution times and then do some statistics on them. Thank You ...

Parsing to a total DateTime object in Rails

I'm currently given three values in a table A date value in the format of %dd-%mname-%yy (i.e 06-may-05), and am parsing that using Date.parse(input,true) to fix the issue with the leading values. I'm then given a time value in the form of %hh:%mm:%ss.%ms (the ms of which I can take or leave) and a third value of a GMT offset. I can't...

Javascript function: Has half a second passed since last time you tried?

I'd like to build a function that returns false if it's been called less that half a second ago. timething.timechill=function(){ var last if (last){ if ((now.getTime()-last)>500){ return true } else{ return true } } else { ...

MySQL - Extracting Time in correct format

Hi, I have a table with a coloumn of type "time", and the values in this coloumn are stored as follows: 20:45:00, 18:00:00, etc. Now when displaying the result, I am not getting the minutes, but just 00. I am using the following to get the time: SELECT TIME_FORMAT(time, '%h:%m') as time FROM ......... etc ...

Python time.clock() - reset clock value with threads

Hi, I see time.clock() on Windows 'starts' a timer when called for the first time, and returns elasped time since the first call for calls after that. I read that the only way to restart the clock is to start a new process. Is starting and killing threads supposed to restart the time.clock() as well? It doesn't seem to be working righ...

How to create simple PHP COMET server page displaying current time?

How to create simple PHP COMET server page displaying current time? I need code implementation (because it should be trivial) - not theory or just links to library sites. Simple text line conteining corrent time and updating each second. ...

time calculation with awk

I've got a file, which looks like: Coding |2010-04-20 12:52|2010-04-20 14:11 Documentation|2010-04-20 22:56|2010-04-21 01:13 Coding |2010-04-21 09:51|2010-04-21 10:58 Coding |2010-04-21 13:11|2010-04-21 14:21 What's the best way - I'm thinking of awk - to do time calculations. As result I expect: 2010-04-20 Coding...

Php trapping maximun execution time error

Is there a way in PHP to trap the fatal error when the max execution time is reached and give the user a better message? ...

Time display query in sql

I have following data UserID UserName LogTime LogDate 1 S 9:00 21/5/2010 1 S 10:00 21/5/2010 1 S 11:00 21/5/2010 1 S 12:00 21/5/2010 Need Output as:- 1 s 9:00 10:00 21/5/2010 1 s 11:00 12:00 21/5/2010 ...

Using DateTime in PHP, generating bad unix epoch time from $foo->format('U')

I can't seem to get the correct Unix epoch time out of this PHP DateTime object. $startingDateTime = "2005/08/15 1:52:01 am"; $foo = new DateTime($startingDateTime, new DateTimeZone("America/New_York")); echo $foo->format('U'); which gives 1124085121 Which is Mon, 15 Aug 2005 00:52:01 GMT -500 (according to http://w...

Calculate date from numeric value

The number 71867806 represents the present day, with the smallest unit of days. Sorry guy's, caching owned me, it's actually milliseconds! How can I calculate the currente date from it? (or) convert it into an Unix timestamp? Solution shouldn't use language depending features. Thanks! ...

PHP: producing relative date/time from timestamps

Hi, I'm basically trying to convert a Unix timestamp (the time() function) to a relative date/time that's both compatible with past and future date. So outputs could be: 2 weeks ago 1 hour and 60 minutes ago 15 minutes and 54 seconds ago after 10 minutes and 15 seconds First I tried to code this, but made a huge unm...

JScript: How to calculate difference between two date-times?

How can I calculate time difference in JScript between two times in milliseconds or seconds? For example, between 2010-04-23 15:03 and 2010-05-30 00:41 ...

long waiting time in linking

Hi, here is the situation. I am using visual studio 2005. the solution contains lots of projects, 34 projects in all, and the start up projects depends on others. then in linking part, it'll wait a long time before the real linking starts. I am pretty sure it's because of too many projects depended, as when I use a solution with 10 of th...

Java Loop every minute.

I want to write a loop in Java that firs starts up and goes like this: while (!x){ //wait one minute or two //execute code } I want to do this so that it does not use up system resources. What is actually going on in the code is that it goes to a website and checks to see if something is done, if it is not done, it should wa...

Problem inserting android.text.format.Time.toMillis value into SQLite DB on droid

I'm writing an app for Android OS, and I need to store some time values in the SQLite DB. I have been using android.text.format.Time to store the time values in the app, and then inserting the values as millis into the DB as REAL values. On the SDK emulator, everything works perfectly. On the sole phone I've had the opportunity to test m...