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
4 answers

Changing a default returned id to an NSTimeInterval

I have a bit of code that calls a method on an object whose .h file I don't have contained in my project, and cannot have contained (I don't want to get into this). However, I know that I need to call a specific function that it does have, which…
Niv
  • 2,294
  • 5
  • 29
  • 41
0
votes
1 answer

Triggering a method at times stored in Array using NSTimer

I have an Array that have stored times. I want NStimer to trigger at times stored in that array. For example, in array a[] i have 2, 5 and 10 seconds and want NSTimer to trigger a method at these times. I do have another NSTimer that keep updating…
Asif
  • 49
  • 1
  • 9
0
votes
1 answer

Getting NSDate for some point in the future

I need to store a date in the future, using NSDate. If I use timeInterval (from now) in seconds, am I going to run into problems when crossing summer/winter time. Is there a way to store, say "this coming Monday at 5.30", in a form which will avoid…
HenryRootTwo
  • 2,572
  • 1
  • 27
  • 27
0
votes
1 answer

NSDate is contained in some interval

I have some data like these: Monday: from 8.00am to 13.pm; 14:00 pm to 20.00pm Tuesdays: from 8.00am to 10 am; 13.00 pm to 17.00 pm; from 17.00 pm to 23.00 pm; ..... Now I would to check if a NSDate (for example now NSDate) is contained in some…
Safari
  • 11,437
  • 24
  • 91
  • 191
0
votes
2 answers

NSTimeInterval in seconds between dates = nan

NSTimeInterval executionTime = [self.EndDownloadTime timeIntervalSinceDate:self.StartDownloadTime]; NSLog(@"Execution Time: %f", executionTime); Result is always "nan". When i switch EndDownloadTime and StartDownloadTime, time is…
Velocity
  • 169
  • 2
  • 8
0
votes
1 answer

Proper way to calculate time for an accessibility label that updates when a UISlider value is changed?

So I am using UISlider for an Audio Player's scrubber. What I am attempting to do is update a label whenever a UISlider's value is changed so that it can properly display the current audio's time elapsed in minutes and seconds. Here is my current…
3254523
  • 3,016
  • 7
  • 29
  • 43
0
votes
0 answers

Getting future date using NSDate and NSTimeInterval

I'm creating a simple timer but am failing to get the resulting date that I'm after. My problem is that I'm getting -34481.274523 from my NSTimeInterval (nslog at the end) whereas I'm wanting the number of seconds since the current date…
user1542125
  • 593
  • 6
  • 16
0
votes
1 answer

NSDateComponents vs timeIntervalSince

I am trying to calculate the number of days from one date to another and have found two ways of doing so. The first uses NSDateComponents as follows: NSCalendar *gregorianCalendar = [[NSCalendar alloc]…
0
votes
1 answer

NSTimer jumping 2 seconds

Please help, I have a NSTimeInterval which I convert into a NSDateComponent and then assign each component (year, month, day, etc) to an appropriate label. After I do the conversion I start an NSTimer to begin a countdown. Here's the code I use: -…
user1563544
  • 379
  • 3
  • 17
0
votes
1 answer

How to correctly get the days for "posted X days ago" for a blog post date

So I'm trying to get the amount of days a blog post was posted ago. The end result would be something like "posted X days ago." After spending some time on the problem, I figured it out by getting the NSTimeInterval, dividing to get days and then…
apolo
  • 441
  • 4
  • 18
0
votes
0 answers

Objective C: Getting NSTimeInterval by a formatted String

I want to make an app which is able to calculate the time at work (and other things like flexitime). Getting a String of a flexitime (which is a NSTimeInterval) by a specific format is really easy and I have written a method for this with the…
0
votes
1 answer

Generate Time intervals based on Data from Database

I have a question that I'm looking for some help with. I have a system that books events and I need to get the 'appointment' information based on data stored in a 'events' table. So here's my question. I have a table that has a 'StartDateTime',…
tparky
  • 33
  • 1
  • 9
0
votes
1 answer

NSDate returning 5 hrs 30 mts extra

i'm using [NSDate date] to get the current date but it is returning 5hrs 30 mts forward. it is returning different time before PM and after PM. My requirement is I want to delete the data in cache after 1 hr of duration. At present I'm using…
user2823044
  • 315
  • 2
  • 5
  • 14
0
votes
1 answer

How to stop function with Timer interval

I would like to stop function like this: - (void)update:(NSTimeInterval)currentTime { if (self.lastUpdateTimeInterval) { _dt1 = currentTime - _lastUpdateTimeInterval; } else { _dt1 = 0; } …
user3215624
  • 55
  • 11
0
votes
0 answers

Multithread execution catch in Objective c

I am running a multithreaded program. One thread(not the main thread) captures the screen continuously every 200ms and write the data to a TCP socket. Another thread will listen for incoming data in the TCP socket. I assume, the problem is caused…
boopathy
  • 427
  • 2
  • 9
  • 20