I'm writing a function that works out whether or not the time is between 9am and 5pm on a working day. It then tells you when the next working day starts (if currently out of business hours) based on whether today's business hours have ended or (if after midnight) are about to begin.
All is going well so far, and to create the most rea...
Hi, I am able to parse strings containing date/time with time.strptime
>>> import time
>>> time.strptime('30/03/09 16:31:32', '%d/%m/%y %H:%M:%S')
(2009, 3, 30, 16, 31, 32, 0, 89, -1)
How can I parse a time string that contains milliseconds?
>>> time.strptime('30/03/09 16:31:32:123', '%d/%m/%y %H:%M:%S')
Traceback (most recent call l...
What is an easy way to time a Cocoa application? (Alternatively, any good way to measure performance would suffice).
(I have two different frameworks and would like to compare their performances over some fixed input data)
...
Dear all,
I want to measure the speed of a function within a loop. But why my way of doing it always print "0" instead of high-res timing with 9 digits decimal precision (i.e. in nano/micro seconds)?
What's the correct way to do it?
#include <iomanip>
#include <iostream>
#include <time.h>
int main() {
for (int i = 0; i <100; i++) {...
Total newbie question here; I apologize in advance.
Suppose I have a daemon written in C that wakes itself up every five minutes or so, does some processing if there's anything in its input queue, and then goes back to sleep. Now suppose there is some processing that it only has to do after a certain (configurable) time--say, 2 pm (and ...
In Python, I'm attempting to retrieve the date/time that is exactly 30 days (30*24hrs) into the past. At present, I'm simply doing:
>>> import datetime
>>> start_date = datetime.date.today() + datetime.timedelta(-30)
Which returns a datetime object, but with no time data:
>>> start_date.year
2009
>>> start_date.hour
Traceback (most r...
I'm developing for the iPhone and am trying to get an initial timeStamp to sync my audioQueues.
I'm using AudioQueueDeviceGetCurrentTime for this. According to the documentation this function gives back a valid mHostTime whether the queue/device is running or not. But when I try this I get back a kAudioHardwareNotRunningError (19370105...
I need to allow users to a commit a certain action on my website once a day and I'd like this it reset at midnight of the users' local timezone. What's the best way to accomplish this with PHP?
...
In question Looking for Good CTIME/Unixtime converter I asked for a good web based CTIME (Seconds since Jan 1, 1970) time converter. (Usually a 32 bit signed integer).
I needed a tool where I could enter a date, and get the CTIME equivalent. I was able to find one, once I realized that Unixtime is the other name for the format. Googl...
Hi
I do a
rs.getTimestamp("datetime")
in Java.
In the database, this datetime is 2009/03/06 02:47:18
but the time is returned as 14:47:18
I'm not very knowledgeable about MySQL dates, so I would appreciate any explanation as to why this is happening.
...
Hi,
I'm parsing an RSS feed which has the time and date as UTC, I need to convert this into a unix timestamp. Is there a simple way to do this?
...
As a new developer who is the only software guy on staff I have faced a few challenges but possibly the most difficult has been time estimates. I strugle every time I have to give a project estimate.
My question then is; If I do not have any experience and I don't have a fellow dev in my environment, how do I provide a solid estimate? ...
I have a form that contains one date element and 3 time elements. This is because 3 time events will occur on one date, and I don't want the user to have to input that date 3 times.
On the server side, I would like to combine the one date with the 3 times to get 3 datetime objects. I was thinking I could just do something like:
time_...
Hello
I am trying to get the difference in hours for two different Time instances. I get these values from the DB as a :datetime column
How can I do this so that it includes the months and years as well in the calculation while ignoring or rounding the minutes? Can this only be done manually or is there a function to do this?
Thank y...
I'm wonderin' how I can write a script to calculate the time the script took to complete.
I thought this would be the case, but obviously not..
@echo off
set starttime=%time%
set endtime=%time%
REM do stuff here
set /a runtime=%endtime%-%starttime%
echo Script took %runtime% to complete
...
I have a program that uses time() and localtime() to set an internal clock, but this needs to be changed so that the internal clock is independent of the user and the "real" time. I need to be able to set any reasonable starting time, and have it count forward depending on a timer internal to the program. Any ideas on the best way to a...
The company I work for creates applications for the Blackberry platform.
We've been working on a proprietary "analytics system" that allows us to embed code within our applications and have the applications report back some stats to our central servers every time they're run. Currently, the system works ok; however it's only in beta wit...
Hi,
I want to get time zone through IP Address in PHP. Actually i have an application which will run at the client machine. I have IP address of client machine. But not able to get the time zone for each client machine.
Please reply me.
Thanks
Devesh M
...
The intention of this question is to gather solutions to date / time calculation using the built in Date class instead of writing long complicated functions.
I’ll write some answers myself, and accept an answer if anyone comes up with something very clever. But this is mostly meant as a collection of solutions, since I often see overly ...
Given a C process that runs at the highest priority that requests the current time, Is the time returned adjusted for the amount of time the code takes to return to the user process space? Is it out of date when you get it? As a measurement taking the execution time of known number of assembly instructions in a loop and asking for the ...