1045
голосов
31ответов
1238020 просмотров

How do I get time of a Python program's execution?

I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running. I've looked at the timeit module, but it seems it's only for small snippets of code. I want to time the whole program.

4
голосов
3ответов
1405 просмотров

Why is java.util.Date's setTime() method not deprecated?

All the other mutators got deprecated back in JDK 1.1, so why was setTime() left as is? Surely java.util.Calendar - the correct way to manipulate dates - can create new instances of java.util.Date as needed using the java.util.Date(long) constructor?

442
голосов
44ответов
640394 просмотров

Calculating the difference between two Java date instances

I'm using Java's java.util.Date class in Scala and want to compare a Date object and the current time. I know I can calculate the delta by using getTime(): (new java.util.Date()).getTime() - oldDate.getTime() However, this just leaves me with a long representing milliseconds. Is there any simp...

68
голосов
13ответов
30523 просмотров

User-friendly time format in Python?

Python: I need to show file modification times in the "1 day ago", "two hours ago", format. Is there something ready to do that? It should be in English.

0
голосов
2ответов
725 просмотров

How to get current localtime using Mysql and PHP?

I read from mysql website, I execute this: SELECT CURTIME() But then how to get the value? Using mysql_fetch_assoc()??

7
голосов
3ответов
37708 просмотров

Time into string with HH:MM:SS format (C-programming)

I need to get the current time in a "HH:MM:SS"-format into a character array (string) so I can output the result later simply with a printf("%s", timeString); I'm pretty confused on the timeval and time_t types btw, so any explanation would be awesome:) EDIT: So I tried with strftime etc, and i...

64
голосов
7ответов
170655 просмотров

Getting Hour and Minute in PHP

I need to get the current time, in Hour:Min format can any one help me in this.

27
голосов
3ответов
4899 просмотров

Writing a time function in Haskell

I’m new to Haskell and I’d like to be able to time the runtime of a given function call or snippet of code. In Clojure I can use ‘time’: user=> (time (apply * (range 2 10000))) "Elapsed time: 289.795 msecs" 2846259680917054518906413212119868890148051... In Scala, I can define the function ...

0
голосов
2ответов
132 просмотров

Minimizing a function dealing with seconds and minutes

Can I shorten this function? $mins = $secs - time('u'); function minutes($seconds){ return sprintf( "%2.2dm %2.2ds", floor($seconds/60),$seconds%60);} $mins_left = minutes($mins); echo "Resets in $mins_left.";

0
голосов
7ответов
3183 просмотров

Calculate minutes until specific time? (C)

What's the simplest way to calculate the number of minutes until 9pm (being today or tomorrow)? Was looking over mktime() but seemed a hassle to get the day # and month, dealing with all that.

1
голосов
1ответов
18149 просмотров

How can I update the Date and Time control panel to match the W32Time service configuration?

I have a client/server application for which it is beneficial to have the PC clocks on the client and server synchronized. I want my setup program to offer an option to configure the W32Time service automatically. I have found sufficient documentation to configure the service's registry entries...

122
голосов
4ответов
71647 просмотров

Cleanest and most Pythonic way to get tomorrow's date?

What is the cleanest and most Pythonic way to get tomorrow's date? There must be a better way than to add one to the day, handle days at the end of the month, etc.

0
голосов
1ответов
2013 просмотров

SSAS 2008 Dimension Wizard and the Date Template

Does anyone know how to use the Date Template with the BIDS 2008, SSAS Project, Dimension Wizard? I keep getting an error - rightly so, I suppose - "Dimension not generated because it is bound to a time binding" (after having selected Generate a non-time table in the data source, in order to get ...

2
голосов
6ответов
14097 просмотров

C++ windows time

I have a problem in using time. I want to use and get microseconds on windows using C++. I can't find the way.

40
голосов
11ответов
45133 просмотров

Regular expression for matching time in military (24 hour) format

I would like a JavaScript regular expression that will match time using the 24 hour clock, where the time is given with or without the colon. For example, I would like to match time in the following formats: 0800 23:45 2345 but that would not match invalid times such as 34:68 5672

11
голосов
7ответов
32059 просмотров

Alarm clock application in .Net

I'm not really writing an alarm clock application, but it will help to illustrate my question. Let's say that I have a method in my application, and I want this method to be called every hour on the hour (e.g. at 7:00 PM, 8:00 PM, 9:00 PM etc.). I could create a Timer and set its Interval to 36...

42
голосов
11ответов
95791 просмотров

Convert Difference between 2 times into Milliseconds?

I have two masked TextBox controls and was wondering how I'd go about getting the time in each one and then converting the difference into milliseconds. Like, say in tb1 I write "12:01" and in tb2 I write "12:02", and then click a button. Once the button's clicked it starts a timer and at 12:02 a...

4
голосов
6ответов
3355 просмотров

Time things with Javascript

How can i time how much time passes between 2 events with javascript? like, to the millisecond?

1
голосов
4ответов
9271 просмотров

MySQL to return only last date / time record

We have a database that stores vehicle's gps position, date, time, vehicle identification, lat, long, speed, etc., every minute. The following select pulls each vehicle position and info, but the problem is that returns the first record, and I need the last record (current position), based on da...

0
голосов
2ответов
2385 просмотров

UNIX System time and User time. C-Programming

Hi I'm trying to get the system time and the user time that are consumed by a program. I'm having some trouble though as my times are always zero in milliseconds. I think I'm doing something wrong. Can you guide me in the right direction ? Both of my methods return 0 typedef struct{ struct t...

24
голосов
5ответов
70645 просмотров

Calculating elapsed time in a C program in milliseconds

I want to calculate the time in milliseconds taken by the execution of some part of my program. I've been looking online, but there's not much info on this topic. Any of you know how to do this?

5
голосов
4ответов
14754 просмотров

How to time a script in DOS?

How do you time a script in the DOS prompt? The *NIX equivanlent would be: $ time myscript real 0m0.886s user 0m0.846s sys 0m0.031s $ Is there a DOS equivalent to this? Thanks

0
голосов
2ответов
128 просмотров

activity in past hour

I am trying to work out if users have had activity in the past hour. The following is my code, but it always returns yes, no matter what: $houraway = (int)mktime() + (60 * 60); $now = mktime(); while($user = mysql_fetch_array($qusers)) { echo $user['Name']." - "; $datetime = explode("...

0
голосов
8ответов
3387 просмотров

Adding time in PHP

I am pulling a datetime from a mysql db and i would like to add X hours to it then compare it to the current time. So far i got $dateNow = strtotime(date('Y-m-d H:i:s')); $dbTime = strtotime($row[0]); then i tried $dbTime + strtotime("4 hours"); but 4 hours seem to add 4hrs to the current tim...

12
голосов
2ответов
13833 просмотров

Retrieve rows grouped by hour with MySQL

I have a table containing access logs. I want to know how many accesses to resource_id '123' occured in each hour in a 24 hour day. My first thought for retrieving this info is just looping through each hour and querying the table in each loop with something like... and time like '$hour:%', give...

1
голосов
8ответов
201 просмотров

Manipulating Dates in PHP without using Regular Expressions

Is there a way to change a date from 1985-12-15 to 1985-12 without using a regular Expression?

1
голосов
2ответов
4517 просмотров

Timing a Curl Operation in Bash

I would like to time how long it takes to submit a batch of files to an HTTP server running on localhost using Curl and write that to a file. I am having trouble getting the syntax correct. export TIMEFORMAT="%R" time -ao times.dat ( curl -v -d @1.batch -X POST $DB ) How can I accomplish this?...

0
голосов
2ответов
179 просмотров

Auto increase php numbers on different lines 0100, 0200 etc

Right now im running something based on time and including files. This is a long file and seems unnecessary. What I want to do is auto increment the times for the 24 times i call code. current style coding: if($time>= "0000" && $time = "0200" && $time Is there a way to assi...

0
голосов
2ответов
761 просмотров

Change Alpha on Main Window - Cocoa

I want to know if I can slowly increase the alpha MainWindow when I open the app and when I close the app. I know it may involve timers, and things like that, but I never dealt with this kind of thing before. I need your help guys...! Kevin

0
голосов
1ответов
139 просмотров

Server-Side Code to Execute Based on a Time Range

We have a Try/Catch block of code in our web application to trap a certain exception. What we want to do with this exception depends on the current time. If it is between 4:30PM and 3:00AM we will want to send an email, otherwise we will throw the exception. What is the best way to accomplish ...