time

The C `clock()` function just returns a zero

The C clock() function just returns me a zero. I tried using different types, with no improvement... Is this a good way to measure time with good precision? #include <time.h> #include <stdio.h> int main() { clock_t start, end; double cpu_time_used; char s[32]; start = clock(); printf("\nSleeping 3 seconds...\n\n"...

PHP to calculate the number of office hours between two dates

We run a service that's based on a 2 business day SLA, so if the request is submitted at 1pm on Monday it should be completed by 1pm of Wednesday. So in the database I have two MySQL timestamps YYYY/MM/DD HH:MM:SS, and need some way of working out the time between the two dates in working time, based on office hours of 9am till 5pm. Ca...

How to return my current time zone in RoR?

When I use return the time that the record created, it show this : 2010-01-20 15:04:40 UTC but I want the time in my specify time zone, for example, China. Is there any convenient method in RoR? ...

Geting time in Java

How can I get seconds from 1970 in java ? ...

Avoid PHP execution time limit

I need to create a script in PHP language which performs permutation of numbers. But PHP has an execution time limit set to 60 seconds. How can I run the script so that if you need to run more than 60 sesunde, not been interrupted by the server. I know I can change the maximum execution time limit in php, but I want to hear another versi...

How can I format a timestamp in Perl?

I would like to get this timestamps formatting: 01/13/2010 20:42:03 - - Where it's always 2 digits for the number except for the year, where it's 4 digits. And it's based on a 24-hour clock. How can I do this in Perl? I prefer native functions. ...

On iphone, how can i get the system date in the proper format

Based on local user settings, I want to get the correct date format. For example, it could be any of these: 5 Jan 2010 January 5, 2010 1/5/10 And how about on windows? Thanks. ...

C# Executing timed commands with varying times

I have a timer control and a grid with a List of coordinates for the grid. I was wondering how I could use the timer control or any other control in order to execute code in the interval, coordinate.Time as it varies for each coordinate. Also, thread.sleep(time) is not an option for me. foreach (Coordinate coordinate in this.Macro) ...

how long does it take to write software?

First as an intro, I am not technical! meaning I do not program :-) although I can and have provided a detailed requirement documant it "seems" to me that the programmers are taking too long to produce the desired s/w First, I would like suggestions how is it best to know if they are on track. Secondly, how long does it take for examp...

What timezone does MySQL TIMESTAMP columns use ON UPDATE?

Does it use the server timezone or UNIX_TIMESTAMP (UTC) ? And how do I get the current time in PHP, in the same timezone as MySQL's TIMESTAMP columns? ...

Local function variables initialization takes processing time?

Local function variables initialization takes processing time? e.g.: void foo ( void ) { char *str = "hello"; int num = 3; } Or, like global variables, their value is assigned already in the read-only section of the binary? In other words: Would it be time-consuming to invoke a function that has many local variables, comparing...

python how to -generate license- using time module

hello . I'm searching for a way to generate a (limited time license) .so when a user starts the program . it has to check license date first before the program runs. but the problem is : i tried a couple of solutions . one of them is python's time.ctime , (to check time and see if it's realy during the license time) and it returns the ti...

What variable should I use if I want to save time values?

I want to make an app that adds 1 minutes and 25 seconds to a TimeLeft variable. Problem is I have no idea what type of variable this should be, or even how to add 1 minutes 25 seconds to the available time left. Any guidance would be much appreciated. I'm good with C#, but since I've never done something like, I'm in the dark. ...

Leap in time in PHP's function time()

Using the timestamp of PHP's time() function, I show the current time to the user with date(). Format: H:i => 13:57 But sometimes there seem to be leaps in time. My windows clock was showing 13:40 when I visited the page. But my website said 14:XX. I don't know the exact time any more. Another example: A user accessed the page "Who is...

How to configure maven multi-module project in Eclipse or Netbeans to reduce deploy time

I have the following project structure project-parent: All the parent configuration is here project-ear: Assemblying the ear file from the ejb, war and core projects project-ejb: EJB module depends on core project-war: Web module depends on EJB and core project-core: no dependencies I was able to use able to use Eclipse or Netbeans a...

How can I convert a function of input size defined recursively into a direct function of problem input size?

Say I have an algorithm which operates on an input of size n and I know that the time it takes for n is twice the time it takes for n-1. I can observe in this simple case (assuming it takes, say, 1 second for n = 0) that the algorithm takes 2n seconds. Is there a general method for converting between recursively-defined definitions to ...

PHP Convert timestamp to months and days

How can I convert a timestamp difference between 2 dates ( $diff = abs(strtotime($date2) - strtotime($date1)); ) to months and days quantity (ouput: $res = 4.05 -> 4 months and 5 days)? Thanks. ...

Time tracking for Redmine?

We just deployed Redmine, but got one problem. There is no easy way to track time spent for project/bug. There is a Redmine Client app, but it is not working with latest redmine. If a developer is not included in single project, app crashes with 403 error, can't edit time correctly (http://server/projects/12/timelog/edit), problem with ...

Using Java to Query a Server for the Time

I want to ask a server, whose IP I know, to send the date and time to a client. How can I implement this in Java? ...

MS-Excel Negative times

I'm writing a spreadsheet for a shop manager. What it does is keep track of the number of hours a worker has worked. So you enter times for Monday-Sunday, and then an adjustment - e.g. if they work 40/40/40/32 hours for the month, then you would have an adjustment of -2/-2/-2/+6 to bring the worker to the 38 hour week that he's being ...