time

What's the result of the SQL statement "SELECT DATEADD(s,1234567890, '19700101')"?

For some reason, my SQL installation isn't working :) SELECT DATEADD(s,1234567890, '19700101') Maybe this site would help (link from Moose). ...

GPS Time synchronisation

I'm parsing NMEA GPS data from a device which sends timestamps without milliseconds. As far as I heard, these devices will use a specific trigger point on when they send the sentence with the .000 timestamp - afaik the $ in the GGA sentence. So I'm parsing the GGA sentence, and take the timestamp when the $ is received (I compensate for...

What do 'real', 'user' and 'sys' mean in the output of time(1)?

$ time foo real 0m0.003s user 0m0.000s sys 0m0.004s $ What do 'real', 'user' and 'sys' mean in the output of time? Which one is meaningful when benchmarking my app? ...

PHP Time after midnight problem

I have an array of times I want to print out. I want the times that have passed lets say 12:00 clock to be 'greyed out'. $theTime = '12:00'; if($theTime >= $time[$i]) {....} 02:30 03:50 03:20 04:50 05:45 19:45 20:00 20:50 20:55 21:25 21:30 22:00 22:45 23:55 00:50 00:55 Im doing a simple compare 12:00 a clock to each value. The p...

php: convert milliseconds to date

I Have a string that is equal to a date, represented as the number of milliseconds since the Unix epoch. I am trying to output it into d-m-Y. The string I was given was "1227643821310", and I am told that the result should be equal to 2-12-2008, but I keep getting a result of 25-11-2008 My code is as follows: $mil = 1227643821310; $s...

Scheduling & DST

I am writing a calendar/scheduling app in php right now. Right now I take the day of the week you want the event to occur on and the time. I also ask for the timezone and adjust accordingly to get the event time in GMT. Then I store that time as an offset from midnight of the day of the show. This is fine and works great, but what ha...

Convert seconds to days, minutes, and hours in Obj-c

In objective-c, how can I convert an integer (representing seconds) to days, minutes, an hours? Thanks! ...

How can I String.Format a TimeSpan object with a custom format in .NET?

What is the recommended way of formatting TimeSpan objects into a string with a custom format? ...

Calculating different tariff-periods for a call in SQL Server

For a call-rating system, I'm trying to split a telephone call duration into sub-durations for different tariff-periods. The calls are stored in a SQL Server database and have a starttime and total duration. Rates are different for night (0000 - 0800), peak (0800 - 1900) and offpeak (1900-235959) periods. For example: A call starts at ...

Should I use Java date and time classes or go with a 3rd party library like Joda Time?

Hi, I'm creating a web based system which will be used in countries from all over the world. One type of data which must be stored is dates and times. What are the pros and cons of using the Java date and time classes compared to 3rd party libraries such as Joda time? I guess these third party libraries exist for a good reason, but I'v...

strftime( ) doesn't display the seconds correctly

I tried strftime( ) to get a formatted time-stamp. char ft[ 256 ]; struct tm *tmp; strftime( ft, 256, "%D - %T", tmp ); My problem is that I get "13/02/60 - 03:07:-17958194" as a result. Is there a way to display the seconds properly? (I'm using Mac OS X and gcc) ...

How to Convert Datareader Result of DbType.Time to Timespan Object ?

I am reading a result from a MS SQL 2008 Database with a column type of dbtype.time from a datareader, using c# with DAAB 4.0 framework. My problem is the MSDN docs say dbtype.time should map to a timespan but the only close constructor for timespan I see accepts a long, and the result returned from the datareader cannot be cast to a lo...

print time in batch file (milliseconds)

How do I print the time (in ms) in a Windows batch file? I want to measure the time that passes between lines in my batch file, but Windows's "time /T" does not print milliseconds. Is there a tiny 3rd party command line utility that does this perhaps? echo %time% won't help because it's evaluated just once and thus prints the same tim...

Excel pivot chart linear time-scale

I have a data set (~10000 rows) with the following form: +---------------------------+---------------+-------------+ | DateTimeCreated | Machine | ProductName | +---------------------------+---------------+-------------+ | 2009-03-03 00:00:12.217 | COMP001 | Product001 | +---------------------------+------------...

What is the best way to deal with time math in Perl?

I am running through two large log files and I want to compare timestamps. I already wrote a Perl script to find the matching log statements, but I need to find the difference in the timestamps. For example, 15:31:19.430888 minus 15:31:19.427763 Are there any good constructs for dealing with time in Perl? I don't want to deal with...

Where is Time.advance documented?

Looking around on the Web I found that the Ruby Time class has Time#advance. Where is this documented? I saw no mention of it in the Ruby API docs here. The search function for the API docs indicated that there is no method called "advance" anywhere. Nonetheless, in IRB... >> t = Time.now => Thu Mar 05 16:08:57 -0800 2009 >> t.advance...

32 bit Linux clock() overflow

I need to measure, in C++ on Linux (and other Unix-like systems), the CPU (not wall clock) time taken by a long computation, so I'm using clock(). Problem: on 32 bit systems, this wraps around after about 2000 or 4000 seconds. What's the recommended workaround for this? ...

Simulating "faster time" in linux

I have a Java app that runs on linux that has a lots of events and business logic that revolve around times and dates. For testing, is it possible to tweak something into time going faster. Let's say, make a whole computer-year finish in one hour wall time? ...

date+time picker for jsf

Is there any ready-to-use component for JSF that allows to chose the Date + the Time of an event? All components I know only allow for date. adding time manually is tedious. ...

How to convert Milliseconds to "X mins, x seconds" in Java?

I want to record the time using System.currentTimeMillis() when a user begins something in my program. When he finishes, I will subtract the current System.currentTimeMillis() from the start variable, and I want to show them the time elapsed using a human readable format such as "XX hours, XX mins, XX seconds" or even "XX mins, XX second...