Questions tagged [nstimeinterval]

an Objective-C Foundation Data Type that specifies a time interval

NSTimeInterval is an Foundation Data Type that specifies a time interval. NSTimeInterval values are in seconds.

Resources

Related Tags

364 questions
0
votes
1 answer

what to check if tasks had been done in between a time interval

I'm not very good with time logic, but will like to check if an user had done a specific task with integer (INT) and Bool (DN) in an interval of 2 minutes. The pseudo code is this Deduction Function 1 if INT <= 4 in 2 mins then -0.5 else if INT >…
Desmond
  • 5,001
  • 14
  • 56
  • 115
0
votes
2 answers

Xcode - NSTimeInterval Years double value, how to get MORE decimals?

i wan't to know exactly how many years it is between 2 NSDate's. (current Date and Date picker date) i'm using NSTimeInterval (seconds) how to make it to years? This code will make the value to Years: NSTimeInterval distanceBetweenDates = [now…
Jonathan Gurebo
  • 285
  • 1
  • 6
  • 19
0
votes
4 answers

Ordering NSStrings that are numbers of a particular format (ex 3:23.123)?

I have NSStrings that represent times of the format mm:ss.SSS in my app. I am trying to generate a list of "fastest times" and I'm struggling trying to figure out what data types to use to order these numbers. What is the easiest way to order…
user990769
  • 115
  • 2
  • 12
0
votes
3 answers

Converting objective c method to c# stringWithFormat:@"%@%.0f%@"

Okay, I am working on converting some objective c code to c# here is what I have. NSTimeInterval now = [[NSDate date] timeIntervalSince1970]; NSData * formattedstring= [[NSString stringWithFormat:@"%@%.0f%@", string1, now, string2]…
0
votes
2 answers

NSTimeInterval seems to be wrong for last day of the given month- iOS

In my local database, I have a list of NSTimeInterval values saved. I have to find out and fetch all records available in a given Month. The only problem is in fetching records for last day of the given month seems to be unavailable. Lets say given…
Tariq
  • 9,861
  • 12
  • 62
  • 103
0
votes
1 answer

Best way to calculate and save user use time in application

What is the best way to calculate the user's use time in my application. Is it ok to save it in NSUserDefaults? In which format I should save it? I want to know if the user lets say played the app 3-4 times, each time he has been playing for 2…
ytpm
  • 4,962
  • 6
  • 56
  • 113
0
votes
2 answers

Adding two values in the strings together in ios

I would like to add the values in the strings together which are in the format:"HH:mm:ss.SSS" and display it back again. In my case, it is adding timeString with difference to get currentString. I am not sure of the correct way of doing it. I am…
lakshmen
  • 28,346
  • 66
  • 178
  • 276
0
votes
1 answer

timeIntervalSince1970 crashing with NSUserDefaults

I'm trying to show a UIALertView every 4 days. But getting a crash because: NSInvalidArgumentException', reason: '-[__NSCFString timeIntervalSince1970]: I tried using different approaches like the following code here:…
CokePokes
  • 941
  • 3
  • 12
  • 25
0
votes
1 answer

Get Missing Months from timeInterval?

Possible Duplicate: Get missing month from timestamp Interval I am receiving time in terms of seconds from server. Then i am using the below code to convert them into months. NSDateFormatter * dateFormatter=[[[NSDateFormatter…
Anshul
  • 279
  • 4
  • 12
0
votes
1 answer

NStimer issue in Cocoa-Touch

My application needs to show a temporary message, so I created Toast like android myself. It works well for only one toast. I am using NSTimer to hide the message. If I display more than one toast the timer becomes a problem. Only the last added…
Madhubalan K
  • 357
  • 5
  • 21
0
votes
1 answer

Nice way to print a dynamic duration to NSString

Possible Duplicate: Fuzzy Date algorithm in Objective-C How do I break down an NSTimeInterval into year, months, days, hours, minutes and seconds on iPhone? I am interested in printing the playback duration of a media item like '1 hour' or '2…
miho
  • 11,765
  • 7
  • 42
  • 85
0
votes
2 answers

How to use automatic scheduled actions to be fired when firing timing may change?

In a certain view I wish to have a certain method fired when the firing timing is based on an array of NSTimeIntervals (which I keep in as NSArray holding double values). So I have a method that does the relevant action according to the relevant…
Ohad Regev
  • 5,641
  • 12
  • 60
  • 84
0
votes
1 answer

NSTimeInterval since1970 to NSDate

I have the following code: -(void)setDate:(double)dateInterval { NSDate *date = [NSDate dateWithTimeIntervalSince1970:(NSTimeInterval)dateInterval]; NSLog(@"NSDate-Result: %@", [date description]); NSDateFormatter *formatter =…
regetskcob
  • 1,172
  • 1
  • 13
  • 35
0
votes
0 answers

Objective-C – NSTimeInterval in a class method returns 0

I have a class method that looks like this: + (NSTimeInterval)calculateTimeDifferenceBetweenEventDate:(NSDate *)eventTime andEventTime:(NSDate *)eventDate { NSTimeInterval timeDifference = [eventTime timeIntervalSinceDate:eventDate]; // If…
Peter Warbo
  • 11,136
  • 14
  • 98
  • 193
0
votes
4 answers

Difference between dot syntax and valueForKey

Please note that update 3 is probably most relevant Im setting a NSTimeInterval property of a managed object with an nsdate object using setValue:forKey: When i attempt to get the value I get weird stuff, at runtime this NSLog(@"[managedObject…
MrJD
  • 1,879
  • 1
  • 23
  • 40