time

Ruby: How to check if a string is a valid time?

I'm pulling data from a feed that I have no control over and I need to verify if a string I'm given is a valid time. Most of the time I'm correctly sent something like "2:35" or "15:41" but other times it's things like "AM" or "PM" (and no numbers)...so I ultimately just need to ignore those. So, how can I verify if the data is a valid...

Correct Time Display

Guys, I''m looking to get this correct and i'm getting a bit fustrated with this. What I want to do is get hours and days and weeks correct. Example: if this post is < 60min old then have it read: Posted Less then 1 minute ago if this post is < 120min old then have it read: Posted 1 hour ago if this post is > 120min old then have it...

JavaScript Add hh:mm + hh:mm to get new hh:mm

I have two javascript vars (they're coming from text boxes, so they're probably being evaluated as strings) in this format: 02:30 and 4:45 they represent hours and minutes. I want to add them together to get 07:15 but I can't figure it out. ...

Name that blog entry - Modelling changes over time with two db columns only.

I vaguely remember reading a blog entry (written by a well-known blogger I think) about how to model price changes over time, and that you could model most changes by saving two dates only (two columns in a db). The blog talked about prices on a website changing over time and how you could figure out the right price to charge knowing onl...

Android get Current UTC time

What is the function to get the current UTC time. I have tried with System.getCurrentTime but i get the current the of the device. Thanks ...

Problem measuring N times the execution time of a code block

EDIT: I just found my problem after writing this long post explaining every little detail... If someone can give me a good answer on what I'm doing wrong and how can I get the execution time in seconds (using a float with 5 decimal places or so), I'll mark that as accepted. Hint: The problem was on how I interpreted the clock_getttime() ...

How can i display seconds ago/minutes ago/with unix timestamp?

I need the unix timestamp - the timestamp i have. Then display the time between like on twitter. ...

adding php time

i have a value store in variables as 11:30. I need to add a minutes to this variable..Example, adding 15 minutes to make it 11:45 can i do that ? i tried to use time() but it will give current time... but i want to add time to the specified variable ...

Changing UILabel over time?

I have a simple UILabel on that I want to change the text of every 10 seconds. What is the best way of doing this, which let's the rest of the interface remain active? ...

Oracle equaivalent of java System.currentTimeMillis()?

Hi, I want to be able to store the current time in milliseconds in an Oracle number field. How do I do this via a query? select systimestamp from dual; returns the actual timestamp. Is there anyway that I can convert this into milliseconds the same way Java's System.currentTimeMillis() does? ...

What's the best replacement for timeGetTime to avoid wrap-around?

timeGetTime seems to be quite good to query for system time. However, its return value is 32-bit only, so it wraps around every 49 days approx. It's not too hard to detect the rollover in calling code, but it adds some complexity, and (worse) requires keeping a state. Is there some replacement for timeGetTime that would not have this w...

How to map Duration type with JPA

I have a property field in a class that is of type javax.xml.datatype.Duration. It basically represents a time span (e.g. 4 hours and 34 minutes). JPA is telling me it is an invalid type, which doesn't shock me. Whats a good solution this? I could implement my own Duration class, but I don't know how to get JPA to "accept" it as a ...

how to get time in millis in c++ just like java

In Java you can do this: long now = (new Date()).getTime(); How can I do the same but in c++ ? ...

Using client time to calculate timezone

Hi Folks, Instead of asking a client timezone in registration form (to correctly format datetime, all server dates in UTC) I thought about fetching a time from client computer and calculating time offset between client and server. Anyone tried this? How often clients have something insane on their system clocks? Cheers! ...

Best way to ensure accurate timing with C

I am a beginning C programmer (though not a beginning programmer) looking to dive into a project to teach myself C. My project is music-based, and because of this I am curious whether there are any 'best practices' per-se, when it comes to timing functions. Just to clarify, my project is pretty much an attempt to build some barebones m...

relativity of the timestamp to the time zone

Hi, I wonder if, when you call something like that time(); it returns the timestamp relatively to your time zone setting or to UTC ? For example, when syncing two agents, that must be important to take care of it, doesn't it ? ...

How do I replace absolute times ("1:30 PM") with relative times ("15 minutes ago") and have them automatically update?

Is there a Javascript script to change the time and date of blogs automaticly like facebook ??? for example "10 minutes ago" instead of "May 15 2010 12:30". -Thank You ...

Idea of developing "Calendar" from scratch

What's the broad math idea behind the calendar if you need to build one from scratch without depending on OS or other libraries ? ...

what's the difference between php time and sql time

Can anyone tell me why the timestamp generated by the php time() function is so different from SQL datetime? If i do a date('Y-m-d', time()); in php, it gives me the time now, as it should. If I just take the time() portion and do: $now = time(); //then execute this statement 'SELECT * FROM `reservation` WHERE created_at < $now' I ge...

Measure time in minutes in C

I am writing a program that will need to measure time in minutes. To be exact, it will wait 10 minutes, execute some code, wait 2 minutes, execute more code and repeat this 5 times (anyone guess what I'm trying to do?) and I am wondering how to do the breaks. Thanks in advance! Oh, and by the way, I'm on Mac. ...