time

Date & Time Stamp Form results via email? How?

I wrote this PHP script to retrieve my form results via email. Everything works great, but I don't know how to add a time and date stamp of the results. Here is my current code: <?php $name = $_REQUEST['name'] ; $carenumber= $_REQUEST['carenumber'] ; $email = $_REQUEST['email'] ; $topic = $_REQUEST['topic'] ; $message = $_REQUEST['mes...

Is something wrong with my down counting in php and javascript?

Hi. I have a function in my game that you only can use every 2 min. So I have this code $next = strtotime ("+2 minutes"); This function to check if 2 minutes has passed: if(time() <= $next){ Here I find the time when you can do the function again: date( "00:i:s", $next - time()) What I need is the number of seconds until you can...

Time Stamp off/ahead 1 hour in php script...

I have a time stamp in my form results script, but the time stamp is ahead 1 hour. Can anyone tell how to adjust the time stamp to be accurate? or is this just on my pc? Here is my current code: $Body .= date("Y-m-d H:i A e"); ...

C++ How can I convert a date in year-month-day format to a unix epoch format?

I need to convert a given date to an int containing the number of milliseconds since Jan 1 1970. (unix epoch) I tried the following code: tm lDate; lDate.tm_sec = 0; lDate.tm_min = 0; lDate.tm_hour = 0; lDate.tm_mday = 1; lDate.tm_mon = 10; lDate.tm_year = 2010 - 1900; time_t lTimeEpoch = mktime(&lDate); cout << "Epoch: ...

can't 'import time' in python, get 'AttributeError: struct_time' How to solve?

Running python on Snow Leopard, and I can't import the 'time' module. Works in ipython. Don't have any .pythonrc files being loaded. Scripts that 'import time' using the same interpreter run fine. Have no idea how to troubleshoot this. Anyone have an idea? [wiggles@bananas ~]$ python2.6 Python 2.6.6 (r266:84292, Sep 1 2010, 14:27:13) ...

set the time in Alarm manager Android - alarm fired instantly

I have this code which will call alarm notification public static Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); cal.add(Calendar.HOUR_OF_DAY,hour); cal.add(Calendar.MINUTE, min); Intent intent = new Intent(this, OnetimeAlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadc...

Kohana execution time is fast, but overall response time is slow, why?

I use the Kohana3's Profiler class and its profiler/stats template to time my website. In a very clean page (no AJAX, no jQuery etc, only load a template and show some text message, no database access), it shows the request time is 0.070682 s("Requests" item in the "profiler/stats" template). Then I use two microtime() to time the durati...

check overlapping start end times, MySQL

Hi, Im stuck with this and need some help. SELECT COUNT(id) AS counter FROM time_reporter WHERE user_id='$user_id' AND actual_date = '$date' AND ((start_time > '$start_time' AND end_time < '$end_time')) It checks ok if in range but i need to make sure if there is a record start , end time so next record could not be i...

Simplest way to show a clock in C++ and Linux.

I'm using C++ under Linux compiling with standard GCC. In my program I want to add a simple clock showing HH:MM:SS. What's the easiest way to do that? ...

Rails distance_of_time_in_words returns "en, about_x_hours"

I'm having a weird problem, hoping someone knows what the issue is... Using distance_of_time_in_words (and consequently time_ago_in_words) is not returning the actual time distance. Instead it is returning things like "en, about_x_hours" or "en, x_minutes". The pattern is correct, as in: time_ago_in_words(50.minutes.ago) => "en, about...

dynamic server time

Hi! As I understand there is no way I can get dynamic server time in IE with settimeout() in script.. I found this example: function timeExam(){ $.ajax({ url : "inc/clock.php", success : function (data) { $("#clock_time").html(data); } }); var func = function() { timeExa...

Seconds to Year

Basically, I am trying to recreate PHP date's year functionality. Using the number of seconds since 1 January 1970, I am trying to get the year with out using a built in function. I had a an idea, but it did not work because of leap years. Can anyone give me a working formula that takes the seconds since 1970 and gets a year from it? ...

Puzzling output of the time command

I am trying to benchmark the run time of one of my scripts. I get following output #time ./foo.py real 0m37.883s user 1m0.648s sys 0m4.680s # Internally, foo spawns multiple other processes and waits till all of them die. From this thread and my earlier understanding of real, user and sys times, I had thought that real time ...

Parse ONLY a time string with DateJS

I'm using the excellent (but large) DateJS library to handle dates and times in my webapp. I just came across something that I'm not sure how to handle. I want my users to be able to enter Time strings only, without a date, but they should be able to enter it in any manner they please. For instance: 5:00 pm 17:00 5:00pm 5:00p 5p etc. ...

Count changes of a value over time?

Hi all, again I am stuck with counting something in MySQL. The database structure is far from SOers´d call optimal, but nevertheless I do not have an influence here and have to live with it. Probably that´s one of the reasons why I need help again to get some information out of it :) Assume I have: some_id (not the PK of the table, n...

logical time versus physical time in ubuntu linux

Hi, i am measuring physical time between two events like this: #include <time.h> #include <sys/time.h> timeval wall_time0; timeval wall_time1; // start of period measurement gettimeofday( &wall_time0 , 0); ...stuff happening // end of period measurement gettimeofday( &wall_time1 , 0); return ( ( wall_time1.tv_sec - wall_time0.tv_...

Temporal libraries for Java

I'm looking for temporal libraries for Java, i.e. libraries which allow to store multiple historical version of the same concept. I'm looking for a library which has an API to do something like: Instant i1 = Instant.valueOf("2010-01-01"); Instant i2 = Instant.valueOf("2010-01-02"); Attribute<String> a = .... a.setValue(i1, "String as ...

Keeping track of time with 1 second accuracy in Google App Engine

I'm currently in the process of rewriting my java code to run it on Google App Engine. Since I cannot use Timer for programming timeouts (no thread creation allowed), I need to rely on system clock to mark the time of the timeout start so that I could compare it later in order to find out if the timeout has occurred. Now, several people...

C# ISO 8601 Time Interval validation

Dear all, I have searched for a while and can't seem to find anything that's related to this. I need to validate an ISO 8601 time interval. There is loads of stuff about ISO 8601 date times but i specifically need interval. I am using a regex and this is what I have so far; Regex regEx = new Regex(@"^P((\d+)Y)((\d+)M)((\d+)D)(T)((\d...

How setTimeout works

How setTimeout in Javascript works at the low level? Is there exist some hardware alarm clock? Or interpreter (through system) just asks periodically what time is now? ...