time

Micro Second resolution timestamps on windows.

How to get micro second resolution timestamps on windows? I am loking for something better than QueryPerformanceCounter, QueryPerformanceFrequency (these can only give you an elapsed time since boot, and are not necessarily accurate if they are called on different threads - ie QueryPerformanceCounter may return different results on diffe...

Is it a bug in Linux time() function or Linux OS calls?

Dear All, I wrote a small program, that creates files at an interval of 1 minute. But the time at which the file is created and last written and the last modification time of the file as shown by ls command differs by 1 second. The code and the output is presented below. please let me know where could be the bug? root@new:/home/sriniva...

How to create TIMESTAMPS for SQL query for it to be sortable by date from PHP?

How to create TIMESTAMPS for SQL query for it to be sortable by date from PHP? So I have table created by such SQL script CREATE TABLE `Keys` ( `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `KEY` INT NOT NULL , `TIMESTAMP` DATE NOT NULL , UNIQUE ( `KEY` ) ) What sript should I write to: Add timestamps To sort\search thru that ...

Convert seconds to Days, Minutes and Seconds.

Hey everyone. I've continuing to learn C++ and I've been set the 'challenge' of converting seconds to format as the Days,Minutes and Seconds. For example: 31600000 = 365 days, 46 minutes, 40 seconds. using namespace std; const int hours_in_day = 24; const int mins_in_hour = 60; const int secs_to_min = 60; long input_seconds; cin >> in...

ATOM date format to UNIX in PHP

So this cant be too difficult, I need a feed date/time converted into a unix timestamp in PHP. from "2010-04-13T10:00:00.000-04:00" -> Unix I have been trying all sorts of weird things with date() and strtotime() with no luck. Thank you! ...

php second countdown

in my php page i have: <?php setcookie("game", "GOW2", time()+3); echo $_COOKIE["game"]."</br>"; echo "<a href=\"/mypro/mypro2.php/\">Refresh</a></br>"; ?> now i want at page load or when user clicks on 'Refresh' the following functionality the timer should get reset and get displayed (as a countdown) and this countdown goes ti...

Converting Milliseconds to Timecode

I have an audio project I'm working on using BASS from Un4seen. This library uses BYTES mainly but I have a conversion in place that let's me show the current position of the song in Milliseconds. Knowing that MS = Samples * 1000 / SampleRate and that Samples = Bytes * 8 / Bits / Channels So here's my main issue and it's fairly simple....

comparing a date string to a date object in jquery

I have been passed a date string that looks like this: Thu%20Mar%2011%202010%2015%3A09%3A11%20GMT%2B0000%20(BST) I want to compare this date with today's date and hopefully ascertain whether the string above has happened yet. With my limited knowledge of jquery/javascript I wrote this: var str = new Date("Thu%20Mar%2011%202010%2015%3...

Setting time to 23:59:59

I need to compare a date range and am missing rows who's date is the upper comparison date but the time is higher than midnight. Is there a way to set the upper comparison's time to 23:59:59? ...

Quarter as a Count variable in SAS.

Hye Guys, I'm busy working on a time series and am trying to find the commands that allow me to insert a quarter count variable. To keep things simple, the third quarter of 1995 (date my observations start) should be quarter -2, the fourth quarter of 1995 should be -1 etc etc uptill 2006 (should be somewhere around 45 by then). My dates...

Efficient AutoSuggest with jQuery?

I'm working to build a jQuery AutoSuggest plugin, inspired by Apple's spotlight. Here is the general code: $(document).ready(function() { $('#q').bind('keyup', function() { if( $(this).val().length == 0) { // Hide the q-suggestions box $('#q-suggestions').fadeOut(); } else { // Show the AJAX Spinner ...

Get seconds since epoch in any POSIX compliant shell

I'd like to know if there's a way to get the number of seconds since the UNIX epoch in any POSIX compliant shell, without resorting to non-POSIX languages like perl, or using non-POSIX extensions like GNU awk's strftime function. Here are some solutions I've already ruled out... date +%s // Doesn't work on Solaris I've seen some...

Date object javascript

Hello. var date = new Date();//Mon Mar 15 2010 12:40:05 GMT+0300 (MSK) var omg = date.getDate() + 19;// 34 date.setDate(omg); document.write(date.toLocaleString()); //Sat 03 Apr 2010 12:43:00 PM MSK How do I echo the values 3 (ie: day of month), 4 (April) and the current year? alert(day); // Need 3 alert(month); // Need 4 Thank ...

Merging datasets with 2 different time variables in SAS

Hye Guys, for those regularly browsing this site sorry for already another question (however I did solve my last question myself!) I have another problem with merging datasets, it seems that accounting for time in datasets is a real pain in the ass. I succesfully managed to merge on months in my previous datasets, however it seems I ha...

monkey patching time.time() in python

Hello guys, I've an application where, for testing, I need to replace the time.time() call with a specific timestamp, I've done that in the past using ruby (code available here: http://github.com/zemariamm/Back-to-Future/blob/master/back_to_future.rb ) However I do not know how to do this using Python. Any hints ? Cheers, Ze Maria ...

Create a page use limit in php?

I'm trying to set up a feature where after accessing a wepage, the user is not allowed to return until they have been away for x minuets. It's on a login system, so I don't need to worry about IPs etc. What I had in mind was as following: User accesses page; current time (of access) is logged (in database?). User tries to return to pag...

timing control for parallel processes

how can i control two processes to run alternately in separate terminal windows. for example i run the code for each on separate terminal windows at 11:59 and both of them wait for the time to be 12:00. at this moment process one starts execution and process two waits for say 10 seconds. then they switch, process two executes and process...

Time Syncronization via Web Service Call

Say are dealing with a Windows network that for internet access must pass through a firewall that you have no control over. Said firewall apparently blocks the known time protocols (NTP,daytime,etc) and you know from experience that those who control it will not allow any exceptions. Is it possible to sync this "Windows" (could be linu...

Why is sys+user > real in "time command"?

I have a program that uses pthread library to do the matrix multiplication of 500x500 matrix. Each thread calculates 50 rows of the matrix. When I run tiem command:- shadyabhi@shadyabhi-desktop:~$ time ./a.out real 0m0.383s user 0m0.810s sys 0m0.000s shadyabhi@shadyabhi-desktop:~$ How come sys+user is greater than real tim...

how to time out an ant task

Without writing a custom ant task is there a way to use a timeout on a regular ant target? To give some background info ... we are using the delete task to remove all contents of a given directory. Sometimes this directory is massive with lots of generated folders and files. We wanted to have that task say timeout after 5 minutes. I coul...