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

Converting a constantly changing scalar value to a changing interval or frequency

Although I'm coding in Objective C, this is more of a general programming question. What is the best way to convert a constantly changing scalar value to a changing interval or frequency? Right now every time the scalar value changes I am destroying…
Bachalo
  • 6,965
  • 27
  • 95
  • 189
0
votes
1 answer

Using NSTimeInterval after using dateFromString

I am working in swift and I am having trouble with NSDateFormatter and NSTimeInterval. What I am trying to do is save a string representation of a date, then later convert it back to an NSDate object and then find the time interval between that…
MID
  • 3
  • 2
0
votes
2 answers

NSTimer timestamp timeinterval question

I have the following code: [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerCount:) userInfo:nil repeats:YES]; -(void)timerCount:(NSTimer *)timer { NSTimeInterval dt = [timer timeInterval]; // do…
okami
  • 2,093
  • 7
  • 28
  • 40
0
votes
2 answers

Double is not convertible to UInt8, Swift error

Error: Double is not convertible to UInt8 (at the last line of code) var beweegsnelheid = NSTimeInterval() var random3 = CGFloat(arc4random_uniform(100)) var beweegsnelheidmax = beweegsnelheid * 1.2 var beweegsnelheidmin = beweegsnelheid * 0.8…
sdd
  • 889
  • 8
  • 29
0
votes
3 answers

Creating a method in objective-c with a delay argument

I'm trying to create a method with an argument in objective-c, the argument is an amount of seconds before the actual method starts. I'm trying to avoid using the [self performSelector:(SEL) withObject:(id) afterDelay:(NSTimeInterval)]; because…
PhilBlais
  • 1,076
  • 4
  • 13
  • 36
0
votes
1 answer

Core Plot NSDate Time Interval on Axis which excludes Saturdays and Sundays

To assure time continuity, I convert NSDates of a time series into time interval, and use for scatterplot or bar chart. The problem now is that Saturdays and Sundays are also included in X axis scale. I wonder if it is possible to excludes weekends…
HSH
  • 111
  • 1
  • 9
0
votes
1 answer

How do you get the seconds since a past date to now?

How can I get the seconds that have passed since 1980-01-01 00:00:00 +1100 using NSTimeInterval? // I need the function to use something like and am having an issue NSDate *aDate = (NSDate*)@"1980-01-01 00:00:00 +1100"; NSDate *seconds = [NSDate…
0
votes
4 answers

Display a negative time in Obj-C

It may sound simple however I am unsure how to do this. How do I display time in the following format?: -00:00:00 I have tried using float and int values of the interval difference between two times however neither give a consistent display in the…
App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
0
votes
1 answer

Adding lives to game each 10min like candy crush

I made a game in spritekit with Swift and want to add lives even when the game is closed like candy crush does. DO I have to use NStimeinterval or does this stop when game stops?
DNC
  • 443
  • 1
  • 6
  • 20
0
votes
2 answers

Need assistance regarding NSTimeInterval and timezone

-(NSTimeInterval)convertStringToDate:(NSString *) date { NSString *dateString = date; NSLog(@"dateString = %@", dateString); NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"dd-MM-yyyy…
S.J
  • 3,063
  • 3
  • 33
  • 66
0
votes
1 answer

Accessing values contained in IOS Arrays and Dictionaries

I am having difficulty understanding how to access values within Arrays using Objective-C My Array looks like this: bualadhBos = @[ @{ @"time":[NSNumber numberWithInt:2875], @"line" : @"Muid uilig ag bualadh bos,…
Linda Keating
  • 2,215
  • 7
  • 31
  • 63
0
votes
2 answers

How to get/convert UTC date from local Date in OSX?

I need to get UTC date by specified NSDate. The problem is that utcDate doesn't calculates properly if date was in daylight saving period. Here is a code I use: NSDate *localDate = [updatesInfo objectForKey:@"date"]; NSTimeInterval timeZoneOffset =…
Serge
  • 2,031
  • 3
  • 33
  • 56
0
votes
2 answers

Get EXEC_BAD_ACCESS when I get the NSFileModificationDate

I try to get the last modification date of a file: NSFileManager *fm = [[NSFileManager alloc] init]; NSError *err; NSDate *lastModif = [[fm attributesOfItemAtPath:filename error:&err] objectForKey:NSFileModificationDate];//filename is ok ;-) if(err…
Toto
  • 15
  • 2
0
votes
0 answers

NSDate timeIntervalSince1970 gives few milliseconds ahead

I am trying to get the current timestamp using [[NSDate date] timeIntervalSince1970] . When printing its value I get a log 1406548777.463378 whereas when checked on http://www.epochconverter.com/ the current timestamp was close to 1406548758 . Can…
user2955351
  • 273
  • 4
  • 18
0
votes
1 answer

NSDate to NSTimeStamp Conversation and NSDates Comparision

I'm the confusion with converting NSTimeInterval to NSDate, I've two dates to compare, one is coming from server and another is in local, In server case, I'm getting date in time interval format, so I've to do the same with local too. I'm taking…
Hemang
  • 26,840
  • 19
  • 119
  • 186