time

Xcode - How do I specify what can and can't be inputted into a text field?

Hey guys, I basically have a working hours calculator in the works and I was wondering how I can disable certain numbers from being put into a field. For example, for the minutes field, I would like to prevent 61-99 being inputted. What sort of code would I need to make that work? ...

comparison between point and integer

Right, basically I want to add two numbers together. It's for a working hours calculator and I've included parameters for a night shift scenario as an if statement. However, it now mucks up the day shift pattern. So I want to sort out that if the start time is below 12, then it'll revert to the original equation shown in the code instead...

Scheduling Python Programs

How would you go about a having a function check something every ten minutes? I would like to check a directory for new files every ten minutes. I know python has a time library but can it be used for this? ...

Is timespec not defined in Windows?

It seems weird to me that this answer is hard to find. I've included time.h and ctime, but vc9 is still complaining about an undefined type 'timespec'. I've searched here, MSDN, and the web (even with the exact compiler error), but I can't find the answer... maybe it's just lost in the noise. Here's the exact error: error C2027: use o...

Coverting a string to a formatted date-time string using Python

I'm trying to convert a string "20091229050936" into "05:09 29 December 2009 (UTC)" >>>import time >>>s = time.strptime("20091229050936", "%Y%m%d%H%M%S") >>>print s.strftime('%H:%M %d %B %Y (UTC)') gives AttributeError: 'time.struct_time' object has no attribute 'strftime' clearly, I've made a mistake: time is wrong, it's a datetime ...

PHP/MySQL: Preventing duplicate actions quickly in succession

For a browser game, I have a database table fights: fightID fromID toID simulated (1=true, 0=false) Whenever a user requests a page, I select all fights which still have to be simulated: SELECT fightID, fromID, toID FROM fights WHERE simulated = 0 These outstanding fights are then simulated in the PHP script and, finally, the figh...

java.util.Timestamp.after() wrong when comparing milliseconds?

I am pulling dates out of an Oracle database. They are set on a java.util.Date field and they are in reality java.sql.Timestamp instances (which is a subclass of Java.util.Date). If I compare two of these timestamps from two different database records by calling after() on the first date and compare it to the second, I get the wrong answ...

2 applications 2 time zones, Can I program around this?

I almost feel dirty having to ask this question, but I am stuck in an unfortunate position. We are rushing to provide a very quick and dirty interim solution. We have a need to run 2 3rd party applications (fortunately not at the the same time). The applications rely heavily on the time. One requires GMT while the other requires BST (B...

Forcing external javascript files (from Digg, Reddit) to load last

I'm working on a WordPress site that has two external javascript files load about half-way down the page. The files are badges from Reddit and Digg, and often add about 4-8 seconds to the total loading time of page — while also preventing the bottom 50% of the page from loading too. The Digg and Reddit javascripts render an <iframe> (wh...

How do I get the local system time in PHP?

Hello, I'm writing a PHP system and I need to get the system time. Not the GMT time or the time specific to a timezone, but the same system time that is used by the CRON system. I have a CRON job that runs every day at midnight and I want to show on a webpage how long will it take before it runs again. For example: Right now it is 6pm ...

Accepting only Valid Time

Alright so in Java I want to ask the user for a time in 24-hour format. I have managed to leverage DateFormat and SimpleDateFormat to tell it what format the time is being entered in and then to interpret that accordingly, throwing an exception if it does not follow that format. Here is what I have: DateFormat fmt = new SimpleDateFormat...

Parse timezone abbreviation to UTC

How can I convert a date time string of the form Feb 25 2010, 16:19:20 CET to the unix epoch? Currently my best approach is to use time.strptime() is this: def to_unixepoch(s): # ignore the time zone in strptime a = s.split() b = time.strptime(" ".join(a[:-1]) + " UTC", "%b %d %Y, %H:%M:%S %Z") # this puts the time_tupl...

Java Date Hibernate cut off time

Hi folks, I have a Date type column in Oracle DB and it contains date and time for sure. But when I'm trying to get data in java application it will return date with bunch of zeros instead of real time. In code it'll be like: SQLQuery sqlQuery = session.createSQLQuery("SELECT table.id, table.date FROM table"); List<Object[]> resultArra...

Time Dependent, How?

I have a database, which is a part of a Library Information system. It keeps track of the books borrowed by customers, keeping the due dates and automating the notification of accountability of customers, if a customer returned a book beyond their due date. Now, I am using MySQL for the DBMS. What I know is that MySQL's time is depende...

How much time in a week a programmer should spend on coding and learning

Hello all I am final year college student. I am trying to figure out how much time i should spend on coding and learning. ...

What's the most efficient way to check whether two long values (in millis) belong to the same second

Currently I'm using TimeUnit.MILLISECONDS.toSeconds(valueInMillis) to check whether two millisecond values come from the same second. Can you recommend a faster algo for this operation? Thanks. ...

"GMT" instead of "UTC" in Ruby 1.8

According to the Ruby docs for Time#zone: As of Ruby 1.8, returns "UTC" rather than "GMT" for UTC times. My OSX-using comrades see this behavior. On my Ubuntu 9.10 system, however, Ruby 1.8.7 seems to prefer the old "GMT" terminology: $ ruby --version ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] $ ruby -e 'puts Time.now.ut...

getting current hour, minutes and seconds in iPhone

Hi! How can I get the current hour, minutes, and seconds from this? NSDate *now = [NSDate date]; Thanks! I want to have 3 int variables with the values stored in them, not a string which displays the values. ...

Returning Time Components with Modulus

Someone does 20 Hours 42 Minutes & 16 Seconds in one shift totaling 74536 seconds. How do I get the hours from number of seconds the person has done for that shift? 20 * 60 * 60 = 72000 42 * 60 = 2520 16 = 16 + ----- Total = 74536 ____________________________...

is there a system event I can hook into for time updates with .NET?

I'm building an application that needs to fire an event every second, but it needs to be at the top of every second. Firing between seconds is not good enough. I don't think a timer will be acceptable since, while I can set it to fire every second, I can not tell it to start at the top of the second. And it will probably drift slightly o...