time

Unix Time Stamp and JavaScript Time; too big!

Hi there, I'm using the flot graphing library for jQuery, and it uses javascript time for any time series (to remind, that's milliseconds since Jan 1970. Unix time is seconds). My current code looks like this: foreach($decoded['results'] as $currentResult) { if($currentResult['from_user'] == $user) { $strippedTexts = $...

Why does tm_sec range from 0-60 instead of 0-59 in time.h?

My time.h has the following definition of tm: struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ int tm_hour; /* hours since midnight [0-23] */ ... } I just noticed that they document tm_sec as ranging between 0-60 inclusive. I've always assumed it ranged fro...

Python speed testing - Time Difference - milliseconds

What is the proper way to compare 2 times in Python in order to speed test a section of code? I tried reading the API docs. I'm not sure I understand the timedelta thing. So far I have this code: from datetime import datetime tstart = datetime.now() print t1 # code to speed test tend = datetime.now() print t2 # what am I missing? # ...

(MS-DOS) Time Delays

I came past a few ways to cause a time delay such as pings and dirs. Though none of them are really precise, is there anny proper way to cause a time delay? I heard about a few things though they don't work on all computers, not on my Windows XP nor the Windows NT at college. It takes ages going through all files on Google finding a go...

add NSTimeInterval to NSDate in cocoa

I've got a NSDate that represents a specific time. The format of that date is hhmmss. I want to add an NSInterval value (specified in seconds) to that time value. Example: NSDate = 123000 NSTimeInterval = 3600 Added together = 133000 What is the best way to do this? Thanks. ...

Are leapseconds taken in account in dotNet (or C#)?

Does the DateTime struct takes care of this? Does any other class/struct? UPDATE : I now have read that leapseconds are only announced 6 months in advance, since the rotation of the earth is not that predictable... Since there's no possibility to implement that in future dates, I can imagine they just omitted them? ...

Javascript Unix Epoch Time Strangeness

I have a portion of script that calculates the days remaining to an event: var currTime = Math.round(new Date().getTime() / 1000.0); var dispDate = event.find('UnixEpoch').text(); var diffDate = (dispDate - currTime) / 86400; var dateRound = Math.round(diffDate) - 30; The first line gets the current Unix Epoch time and shaves off the ...

How to handle short coding sessions?

I'm working on some pet projects and generally I sit around my personal computer about 22:30 or 23:00 to code. But since I try to sleep about 24:00 I don't start coding and ending up reading articles, playing some games etc. I don't feel like I can write decent code in an hour, because the project is quite big and I don't want to random...

Faster javac/ant?

I find java starts up and runs practically instantly for me - but javac takes a few seconds, and ant makes it slower again. It's only a few seconds, but my edit-compile-test loop would be smoother without it. :-) BTW: I've already used vim's ":make" with ant. Is there a way to speed up javac and/or ant? I'm thinking of special switc...

Daylight savings time in Sql Server

We're using an old application that stores dates in C / Unix format. C time is basically the number of seconds since Jan 1st, 1970. The dates are stored as an integer in a SQL Server database. I am writing a view for a report that uses these dates. So far, I'm converting from the UNIX time to a native datetime with: DateAdd(s,3600+uni...

Duration vbscript (vbs) function

Is there a function to convert a specified number of seconds into a week/day/hour/minute/second time format in vbscript? eg: 969234 seconds = 1wk 4days 5hrs 13mins 54secs ...

Ruby Time.parse gives me out of range error

I am using Time.parse to create a Time object from a string. For some reason Time.parse("05-14-2009 19:00") causes an argument our of range error, whereas Time.parse("05-07-2009 19:00") does not Any ideas? ...

Store time of the day in SQL

How would you store a time or time range in SQL? It won't be a datetime because it will just be let's say 4:30PM (not, January 3rd, 4:30pm). Those would be weekly, or daily meetings. The type of queries that I need are of course be for display, but also later will include complex queries such as avoiding conflicts in schedule. I'd rather...

time since JVM started

Is there a way to find out the time since the JVM started? Of course, other than starting a timer somewhere near the beginning of main, because in my scenario I am writing library code and the requirement that something be called immediately after startup is a too burdensome. ...

How can I get rid of the warning with rand()? (C++)

Whenever I use the rand function in C++: #include<iostream> #include<time.h> #include<stdlib.h> using namespace std; int main(){ srand(time(0)); int n=(rand()%6)+1; cout<<"The dice roll is "<<n<<"."<<endl; } I get a warning about conversion from time_t to int at line 5: srand(time(0)); Is there any way to get rid of this warning? ...

Is there a good jQuery plugin or JS code for time durations?

I basically want to produce the following: from int 67 to 1 minute 7 seconds from int 953 to 15 minutes 53 seconds from int 3869 to 1 hour 4 minutes 29 seconds pseudo code: // original <span class="time">67</span> //output <span class="time">1 minute 7 seconds</span> // js $('.time').format_duration(); ...

display of wrong time

I have written a method using JSF: public static String getCurrentTime(Locale locale) { Calendar cal=Calendar.getInstance(locale); return new SimpleDateFormat("HHmmss").format(cal.getTime()); } While testing my application in my local machine I am getting the time same as system time but when my friends are testing...

How to control what happens when a program is iconned in Windows XP

I have a real-time program that needs to be operating continuously. When the program is iconned, it seems that it sometimes stops updating and other times will abort when it is restored to the active state. Is there a method of controlling what happens when my program is iconned? I am using Visual Studio 2005. ...

How can I calculate the number of days between two dates in Perl?

Heylo, I want to calculate (using the default Perl installation only) the number of days between two dates. The format of both the dates are like so 04-MAY-09. (DD-MMM-YY) I couldn't find any tutorials that discussed that date format. Should I be building a custom date checker for this format? Further reading of the Date::Calc on CPAN ...

Can I add a reference to System.Core.dll (.net 3.5) to a .net 2.0 application and use it

Can I add a reference to System.Core.dll (.net 3.5) to a .net 2.0 application and use it I am trying to use the TimeZoneInfo class which is available in .net 3.5 only, by referencing System.Core.dll Alternatively, is their an alternate for TimeZoneInfo in .net 2.0 (or a customised class) ...