time

Converting seconds into period of time (PHP)

I have a bug reported whereby the user selects a date frame from a dropdown, hours, days, months and enter a freetext number. When it's saved this is converted to a number of seconds. I need to display this field as currently it's not being displayed. How can I work out how to make it into the same value they entered? We do not store t...

C++ time_t problem

Hi SO, I'm having trouble with dates management in C++ (VS 2008). According to MSDN specifications, time_t represents: The number of seconds since January 1, 1970, 0:00 UTC therefore, I've written this piece of code: #include <stdio.h> #include <time.h> time_t GetDate(int year, int month, int day, int hour, int min, int sec) { ...

Rfc 1123 in python

Hi guys. Just want to use 'datetime' or 'time' modules. I based the following code on this question: import time def rfc1123 (gmt): weekday = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][gmt.tm_wday] month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][gmt.tm_mon] return "%s, ...

Java Problems - ArrayList and Time Elapsed Function

I'm trying to create 5 ArrayLists of various size, fill them with random numbers between 0 and 1, and then time (and print) how long it takes to iterate through each. I think I've initialized and filled them correctly. But when I iterate through and check the time, the numbers are off. I get something like (0, 0, 2, 0, 0 seconds) when t...

create object based on time in c++

hi, i am writing a simulation about vehicle manufacturing, i am wondering how i can create objects based on time.. i have a base class Vehicle, and children Motorbike, Car, and Truck. 1 Motorbike will be manufactured every 1 hour, 1 car will be manufactured every 3 hours, and 1 truck will be manufactured every 8 hours. how can i create...

Are there existing python modules for dealing with / normalizing units of time represented as strings?

I am new to python and am doing an export and import to a new db. I have a column on my export (to be imported) of strings for units of time, "20 minutes" "1.5 hours" "2 1/2 hours", etc. I tried googling but couldn't really find any good phrases and kept coming up with information more related to datetime units rather than just units ...

MySQL or PHP date averages

Hey, I am trying to figure out how to find the average of a number of different time values, the time values are time differences from 2 dates so they will be in the format of "hh:mm:ss". So if I had 4 time values of: 00:11:05 00:01:30 00:04:25 00:09:50 I am having trouble figuring this out. I am thinking that these time values woul...

C - How to print time in format: 2009‐08‐10
18:17:54.811

What's the best method to print out time in C in the format 2009‐08‐10
18:17:54.811? Atm, I have Thu Sep 9 11:10:08 2010 but can't figure out the above. ...

jquery timepicker and timezone set

Hi I am trying to use the jquery timepicker and have the following issues I want to show the start time which is in the time zone I am setting it to. I cannot use startTime = new Date() as that takes the system time and if that is different for each user from different location the time is going to be different. I am trying to allow us...

How to determine the complexity of an algorithm function?

How do you know if a algorithm function takes linear/constant/logarithmic time for a specific operation? does it depend on the cpu cycles? ...

Bash: subtracting 10 mins from a given time.

In a bash script, if I have a number that represents a time, in the form hhmmss (or hmmss), what is the best way of subtracting 10 minutes? ie, 90000 -> 85000 ...

Daylight Savings Time not calculated properly in Rails 2.3.5?

Hello, I have a very strange issue with Daylight Savings Time (DST) in my app. For some reason, whenever I receive a time from the table, it doesn't adjust itself for DST. For example, if I create a new Time in the console, in the appropriate time zone, write it to the database, and then try to retrieve it from the database, it comes ba...

How to get time it takes for an application to startup?

I am writing a C# application that needs to be able to tell how much time it takes for a certain application to open. I am using the Stopwatch class as my timer. Start time is easy since I set it exactly with the call to run the .exe. The problem is finding out how to time when the program is done opening. The only thing I could thin...

Using time command in bash script

I'd like to use the time command in a bash script to calculate the elapsed time of the script and write that to a log file. I only need the real time, not the user and sys. Also need it in a decent format. e.g 00:00:00:00 (not like the standard output). I appreciate any advice. ...

CoreMedia.CMTime

I want to use the method Seek of the class AVPlayer. But this method take a parameter CMTime. Could anyone knows about this object. In order to move the playback cursor to a given time. ...

Time of Day Lockout By User Proxy Server Router

I currently have the Astaro Security Gateway ISO loaded on a beige box and it does what I want: Blocks direct access to the Internet making it's proxy server (with authentication) the only path to the Internet. Then, each user is subject to a different set of rules, for instance don't allow user "A" to connect after 11pm on a school nig...

rand() seeding with time() problem

I'm having difficulty figuring out how to use rand() and seeding it with time() using Xcode. I want to generate random decimal numbers between 0 and 1. The code gives me seemingly random numbers for elements 1 and 2, but element 0 is always somewhere around 0.077. Any ideas why this would be? My code is: #include <stdio.h> #include <s...

Python: Initialize a datetime object with seconds since epoch

Hi, The time module can be initialized using seconds since epoch: >>> import time >>> t1=time.gmtime(1284286794) >>> t1 time.struct_time(tm_year=2010, tm_mon=9, tm_mday=12, tm_hour=10, tm_min=19, tm_sec=54, tm_wday=6, tm_yday=255, tm_isdst=0) Is there an elegant way to initialize a datetime.datetime object in the sa...

UI design: display events in different timezones on same calendar

I'd like to show events on a calendar for my web service's customers. There are four scenarios possible in regards to timezones for these events: An event is local to the customer and is in the same timezone. For example, a meeting with a local business. An event is physically located in a different timezone than the customer, but it i...

Is there anyway to figure out the java timeslice on windows?

I know that the jvm timeslices threads, at least on windows. Is there anyway I can find out what the default timeslice is, or change the timeslice? One way I thought about is to write my own round robin scheduler and run it as a thread at a high priority level, and have it control all other threads. Would that work? ...