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
-1
votes
1 answer

Time in objective c returns as 0

I'm working on a counter, and this is my code to find the time. NSDate *start = [NSDate date]; NSTimeInterval timeInterval = [start timeIntervalSinceDate:start]; NSLog(@"%f",timeInterval); This is what it returns over and over again. 2014-03-08…
-1
votes
2 answers

NSTimeInterval is always 0

Did some research on the topic but still don't get it. NSTimeInterval is always 0 when using [NSDate timeIntervalSinceDate:NSDate]. Example. - (NSNumber*) elapsed { __block NSDate* currentDate; dispatch_async(dispatch_get_main_queue(), …
George Taskos
  • 8,324
  • 18
  • 82
  • 147
-1
votes
1 answer

dateByAddingTimeInterval: is giving incorrect result

I'm trying to use dateByAddingTimeInterval: to add 8 days to my current date but it gives me a weird result. This is the code I'm using: -(void)requestForGetEPGChannelsProgramsSucceed:(id)jsonResponse andEpgId:(NSString *)epgId forDate:(NSDate…
user2328703
  • 227
  • 2
  • 11
-1
votes
3 answers

NSTimer not calling value update method

Hello friends I am new to iOS development. I have one issue related to NSTimer. I am using NSTimer in my view controller. Timer starts decreasing value on the UIButton event. After calling timer when i goes to another view controller. Then timer…
Pradhyuman sinh
  • 3,936
  • 1
  • 23
  • 38
-1
votes
1 answer

Call method with object NSTimeInterval fails

I'm working on an app, in which I would call a method, and pass in parameter an NSTimeInterval. My method is declared like this : -(void)MethodwithTime:(NSTimeInterval)t { NSLog(@"Test, T = %f", t); ... } I call it from a…
user2057209
  • 345
  • 1
  • 6
  • 19
-1
votes
1 answer

How to compare the NSTimeInterval(NSNumber Objects) inside a NSMutableArray?

I have two NSMutableArrays(arrayContainsGoodClicks and arrayContainsBadClicks). I am initializing these Arrays with some NSTimeInterval values when the relevant Good and Bad buttons are clciked. Now my requirement is, i am getting responses from a…
Pradeep Reddy Kypa
  • 3,992
  • 7
  • 57
  • 75
-2
votes
2 answers

Calculate time interval to 0.00 of the next day according to GMT in swift or objective-c?

I tried something like this: var calendar = Calendar.current var dayFutureComponents = DateComponents() dayFutureComponents.day = 1 // aka 1 day var d = calendar.date(byAdding: dayFutureComponents, to: Date()) ...//setting of d.hour, d.minute,…
Vyachaslav Gerchicov
  • 2,317
  • 3
  • 23
  • 49
-2
votes
2 answers

iOS: Get NSTimer to fire 5 seconds from now

THE SCENARIO I am working on an app that needs to fire off a method 5 seconds after a button is tapped. THE CODE This is the code that is supposed to set off the controlTimerExpire method after 5 seconds NSDate *fiveSecondsFromNow = [[NSDate date]…
Brandon A
  • 8,153
  • 3
  • 42
  • 77
-2
votes
2 answers

Swift Dates and Times

I am trying to work out the number of seconds between two times. My proposed method is to get the Unix times for ' Date 1' and 'Date 2' then deduct them to get the number of seconds. The second date will be in the format of a string. How do I…
MattBlack
  • 3,616
  • 7
  • 32
  • 58
-2
votes
1 answer

Format NSTimeInterval with NSDate

I have a function in Swift that outputs the following information: 1970-01-01 00:00:06 +0000 1970-01-01 00:00:07 +0000 etc. It's essentially a stopwatch. I want to take that number and format it into just 00:00:00 with minutes, seconds and…
-2
votes
1 answer

How compare the user actual time with a NSArray?

I have a NSArray with many different hours as NSStrings. My question is, how can I compare the actual time of the user with the values into the NSArray and get which is the next hour to the actual user? For example, if the NSArray has got @"07:00",…
BigK
  • 43
  • 7
-2
votes
2 answers

How to Convert NSString into NSTimeInterval

I have NSString that has value "22/04/2013 05:56", as per the requirement I just want to calculate this time and date and show some condition based messages. First condition: If (String date = current date and stringtime = current time)||(string…
iMash
  • 1,178
  • 1
  • 12
  • 33
-3
votes
3 answers

Find difference between just the time of two dates in seconds

I have 2 dates. I don't care about the date portion, just the time. How can I compare 2 dates and get the timeinterval between 2 dates? Should I set the dates to 01-01-2000 and leave the time alone to compare?
Jason Jardim
  • 15
  • 1
  • 2
-3
votes
1 answer

How to count all the similar dates in a separate column

I'm trying to sum all of the similar Date/time rows into one row and a "count" row. Therefore I'll get two columns- one for the Date/Time and one for the count. I used this argument to round my observations into a 15 minute time period: dat$by15 <-…
-3
votes
1 answer

Convert NSTimeInterval to Days, Hours, Minutes, Seconds

I have 2 DATES. End Date Current Date Now, I want to find NSTimeInterval and Calculate remaining time in Days, Hours, Minutes, Seconds. I do not want to use NSDateComponents. I want some formula that calculate that gives remaining time in Days,…
Monika Patel
  • 2,287
  • 3
  • 20
  • 45
1 2 3
24
25