time

What's the best alternative library to gettimeofday() in C++?

Hi, Is there a more Object Oriented alternative to using gettimeofday() in C++ on linux? I like for instance to be able to write code similar to this: DateTime now = new DateTime; DateTime duration = new DateTime(2300, DateTime.MILLISECONDS) DateTime deadline = now + duration; while(now < deadline){ DoSomething(); delete now;...

What's an elegant way to retrieve all times of the day (1 hour resolution) in DB2 without a backing table?

I'm querying some data from a table in DB2/z which holds hourly data but occasionally skips some hours (if the clients don't send up details for that hour). Since I'm feeding the data straight into a charting tool which needs a query to get the axis data, it sometimes has missing values from the time axis and looks ugly: 23.00 |=== 22....

JavaScript date constructor and timezone

The Date constructor in JavaScript/ECMAScript/JScript allows passing the number of milliseconds since midnight, 1/1/1970. Nowhere can I find documentation whether this is midnight in the client machine's timezone, or midnight GMT. Which is it? Can it be relied on between different browsers and versions? Is this officially documented a...

convert String to DateTime

I need to parse following String into a DateTime Object: 30/Nov/2009:16:29:30 +0100 Is there an easy way to do this? ...

Is it possible to get the transfer time in milliseconds using wget?

Generally, wget shows transfer time in seconds... Is there a way I can get it to show the time in milliseconds? ...

PHP Convert Unix time to ISO and Subtract an Hour

Hello, I'm restructuring my MySQL database, which has several columns in Unix format. Because I already have several rows in the database in Unix format. How can I convert the Unix fields to iso, and then subtract an hour using PHP? For example, I currently have: <?php $unix_time = 1267840800; $conversion = date("c", $unix_time...

Mysql Average on time column?

Hi i have this query: SELECT avg( duration ) as average FROM `login`; The datatype for duration is "time", thus my value is like: 00:00:14, 00:20:23 etc I execute the query it gives me: 2725.78947368421 What is that? I want in time format, can mysql do the average on time?? ...

time.localtime() - how does it work? Brief questions on how to use it too - super easy stuff!

How does time.localtime() work exactly? I can call up the "array" (tupple, I think it is called - because it is immutable?) and reference/index components of it. For example: >>> time.localtime()[0] 2010 But if I do: print time.localtime() time.struct_time(tm_year=2010, tm_mon=2, tm_mday=7, tm_hour=14, tm_min=46, tm_sec=58, tm_wday...

sql query date time

i have a datestamp field in my table structure. using sql, i want to find any user who registered in yesterdays date using these time range. eg: 2010-02-06 14:00:00 2010-02-07 10:00:00 i will be running this query once a day to grab users. so tomorrow will be: 2010-02-07 14:00:00 2010-02-08 10:00:00 the day after tomorrow will be: ...

javascript / jquery time count down

Hello I want to make a function either using pure Javascript or also benefiting from jquery to count down to an ending time such as: //consumes a javascript date object function countDown(endtimme){ ... } and it should display in html such as <div id="time_left_box"> <h1>Time remaining</h1>: <p>hours left: ..remaining day wi...

JFormattedTextField : input time duration value

I want to use a JFormattedTextField to allow the user to input time duration values into a form. Sample valid values are: 2h 30m 72h 15m 6h 0h However I am having limited success with this. Can some one please suggest how this can be accomplished? I am OK if this result can be achieved using a JTextField as well. Thanks! If it is w...

Delete Old directories in Python

Hello, I have several directories and I want directories over 7 days old to be deleted. I have code already implemented but It doesn't seem to be working. Can anyone see where I am going wrong? def delete_sandbox(): for directories in os.listdir(os.getcwd()): if not os.path.isdir(directories) or not os.stat(directories)....

JFormattedTextField using a regular expression formatter?

After much frustration with getting a JFormattedTextField to work with my custom formats, I was wondering if there was a Formatter or FormatterFactory that uses regular expressions? My idea is that if there is one, then I could wrap it in a static class and invoke it like so: mFormattedTextField.setFormatterFactory( SomeStaticClass...

Reliable Web API for requesting Time

Having read a question about the reliability of the PHP time function, I wondered if there was some kind of 'reliable' web API to retrieve time from. ...

Sorting an arraylist of objects by date using SS::MM::HH MM/DD/YY/ format

Hi, I have an arraylist of objects, each containing a unique date in the following format YEAR-DAY-MONTH HOUR:MINUTE:SECOND (example: 2010-02-10 23:32:14) I'm trying to compare each object in the array list (there are a few thousand) with a incrementing timer class I created to check if both times match. It seems like the easiest wa...

How to get seconds since epoch (1/1/1970) in VBA?

How can I get seconds since epoch (1/1/1970) in VBA? ...

How to accurately sync time between iPhones?

I am writing an application that will require me to sync the time on a large number of iPhones accurately (to within a fraction of a second). As far as I can tell, access to the time function of the GPS is not available. If I sync over the Internet, then the biggest problem is network latency. The delay before the answer to a request is ...

SQL Stored Procedure Problem due to the Lack of SP Performance

The main problem is that in my sp there are different objects and logic that may cause lack of performance. The things that I see on my SP and the tables that are in use in the SP 1- Temp tables such as shown below; (2 Temp Tables) CREATE TABLE #TEMP_TABLE( AB INT NOT NULL, AC INT NOT NULL, AD INT NOT NULL, AF INT NULL, AG IN...

CakePHP: Time input with quarter-accuracy

I'm using $form->input("time") to render select boxes for time input. They have minute-accuracy, which I don't need. How could I limit the select lists to quarters (XX:00, XX:15, XX:30, XX:45)? ...

Working with date and time

I have a UTC date of Tue, 16 Feb 2010 03:12:02 UTC +00:00, for example. I want to add 168 hours to this date to get a future UTC date. What's the best way to do that? ...