time

How can I determine a web user's time zone?

Is there a standard way for a web server to determine what time zone offset a user is in? From an HTTP header or part of the user-agent description, perhaps? ...

Help with CRON jobs?

How can i set up my crontab to execute X script at 11:59PM every day without emailing me or creating any logs? Right now my crontab looks something like this @daily /path/to/script.sh ...

Design debate: what are good ways to store and manipulate versioned objects?

I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers. I'm in the middle of designing an app that does something like portfolio management. The design I have so far is Problem: a problem that needs to be solved Solution: a proposed soluti...

Dealing with PHP server and MySQL server in different time zones

For those of us who use standard shared hosting packages, such as GoDaddy or Network Solutions, how do you handle datetime conversions when your hosting server (PHP) and MySQL server are in different time zones? Also, does anybody have some best practice advice for determining what time zone a visitor to your site is in and manipulating...

How to display "12 minutes ago" etc in a PHP webpage?

Can anyone tell me how I can display a status message like "12 seconds ago" or "5 minutes ago" etc in a web page? ...

If I have a PHP string in the format YYYY-DD-MM and a timestamp in MySQL, is there a good way to convert between them?

I'm interested in doing comparisons between the date string and the MySQL timestamp. However, I'm not seeing an easy conversion. Am I overlooking something obvious? ...

“rusage” statistics

Hello, I'm trying to use “rusage” statistics in my program to get data similar to that of the time tool. However, I'm pretty sure that I'm doing something wrong. The values seem about right but can be a bit weird at times. I didn't find good resources online. Does somebody know how to do it better? Sorry for the long code. class StopW...

What is the most efficient way to populate a time (or time range)?

While plenty of solutions exist for entering dates (such as calendars, drop-down menus, etc.), it doesn't seem like there are too many "standard" ways to ask for a time (or time range). I've personally tried drop-down menus for the hour, minute, and second fields (and sometimes an "AM/PM" field, as well). I've also tried several clock-...

What should we do to prepare for 2038?

I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970. #include <stdio.h> #include <time.h> #include <limits.h> void print(time_t rt) { struct tm * t = gmtime(&rt); put...

Datetime arithmetic with a string in Ruby

In Ruby, I'm trying to do the following. def self.stats(since) return Events.find(:all, :select => 'count(*) as this_count', :conditions => ['Date(event_date) >= ?', (Time.now - since)]).first.this_count end where "since" is a string representing an amount of time ('1 hour', '1 day', '3 days') and so on. Any suggestions? ...

What is the simplest way to find the difference between 2 times in python?

I have 2 time values which have the type datetime.time. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type datetime.datetime but not for datetime.time. So what is the best way to do this? ...

How to parse relative time?

This question is the other side of the question asking, "How do I calculate relative time?". Given some human input for a relative time, how can you parse it? By default you would offset from DateTime.Now(), but could optionally offset from another DateTime. (Prefer answers in C#) Example input: "in 20 minutes" "5 hours ago" "3h 2m...

Resetting detection of source file changes

I sometimes have to work on code that involves me moving my clock ahead forward. In this case some .cpp or .h files get their last modification date updated to the future time as I work on them. Later when my clock is fixed, and I go to compile, it requires a rebuild of most of the project because some of the last modification dates ar...

How do you measure the time a function takes to execute?

How can you measure the amount of time a function will take to execute? This is a relatively short function and the execution time would probably be in the millisecond range. This particular question relates to an embedded system, programmed in C or C++. ...

How can you insure your code runs with no variability in execution time due to cache?

In an embedded application (written in C, on a 32-bit processor) with hard real-time constraints, the execution time of critical code (specially interrupts) needs to be constant. How do you insure that time variability is not introduced in the execution of the code, specifically due to the processor's caches (be it L1, L2 or L3)? Note ...

What is your choice for a Time Managment Solution?

I've come across a few different applications that monitor my usage while on the computer, but what have you used, and like? whether it be writing down your activities in a composition notbook or install an app that reports silently to a server? what do you like? ...

How can I calculate time schedules (for free)?

I am running a small office for a while and need to do some scheduling. Employees have widely varying availability (part time environment), and there are certain times of the day where I need certain numbers of people there. I also want to impose constraints as far as how many hours each person works. I have looked, and perhaps I have...

Time Parsing in Flex

Is there any way to parse a string in the format HH:MM into a Date (or other) object using the standard libraries? I know that I can parse something like "9/17/2008 10:30" into a Date object using var date:Date = new Date(Date.parse("9/17/2008 10:30"); But I want to parse just 10:30 by itself. The following code will not work. var ...

Measure Total Network Transfer Time from Servlets

How do i measure how long a client has to wait for a request. On the server side it is easy, through a filter for example. But if we want to take into accout the total time including latency and data transfer, it gets diffcult. is it possible to access the underlying socket to see when the request is finished? or is it neccessary to d...

What languages do date, time, and calendar operations really well?

This is probably too much to ask, but is there any language that does a really terrific job of representing time and date operations? I'll grant straight away that it's really hard to write a truly great time library. That said, are there any widespread languages that have one? Basically, I want something that handles time and date as...