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

Using Decreasing Variable as NSTimeInterval in swift

I am trying to decrease a Double variable by 0.05 every second to speed up the function spawnEnemy() but I cannot find a way that works well. So, I am trying to pretty much "spawn" more enemies(UIButtons) in a shorter amount of time. Any help would…
user5698241
0
votes
1 answer

Swift - timeIntervalSinceNow Only want to show up to minutes (excluding the seconds part)

I'm using a timeIntervalSinceNow function to determine the difference between a certain time and the current time. I have used the "ZeroFormattingBehaviour" to .DropAll to get rid of any 0's in the date. However I want to make it so the difference…
Antonio C
  • 71
  • 1
  • 9
0
votes
1 answer

How can I get the date in 24 hours format

NSDate *localDate = [NSDate date]; NSTimeInterval timeZoneOffset = [[NSTimeZone systemTimeZone] secondsFromGMTForDate:localDate]; NSDate *gmtDate = [localDate dateByAddingTimeInterval:-timeZoneOffset]; This gives me time in 12 hours format. So, for…
Natasha
  • 6,651
  • 3
  • 36
  • 58
0
votes
1 answer

swift : get the closest date stored in the core data

I have two data in core data. Entity Name = "Contact", Attribute Name = "date"(selected datePicker.date), "content"(textFeild.text) It is that sort of information in a table view, was a success. I want to show only one content in the another view…
Iden Lim
  • 117
  • 2
  • 7
0
votes
2 answers

How to change the NSTimeInterval of an NSTimer after X seconds?

I'm making an app in swift 2 where there is two timers. After 10 seconds I would like another timer to go faster. I have tried doing it like this but it didn't work (I'm trying to change the var time to 1): @IBOutlet var displayTimeLabel:…
Anton O.
  • 653
  • 7
  • 27
0
votes
1 answer

Internet speed detection in swift

I am trying to detect speed of my internet using NSURLConnection. What I do is, I start downloading a file, in delegates of NSURLConnection, I start a time and then when the download finishes, it gets the time frame as well as the data received and…
Saty
  • 2,563
  • 3
  • 37
  • 88
0
votes
3 answers

Convert NSTimeInterval to NSData and back to NSTimeInterval

How do I convert an NSTimeInterval value to NSData?
Dror Chen
  • 51
  • 1
  • 10
0
votes
1 answer

Use NSTimeInterval to trigger notification in WatchOS2

I am trying to make a pomodoro app on the Apple Watch (OS2). I want to trigger a notification after the countdown is finished, in the first step I am trying to print some word in console, but it still does not works. How to use NSTimeInterval to get…
0
votes
2 answers

How to get and convert back user's birthdate to/from a NSTimeInterval?

Suppose, my birthdate is (mon/day/year) 10-05-1932 (as NSDate), how to convert this to NSTimeInterval. Again, how to convert back that NSTimeInterval to NSDate back? I tried using different methods of NSDate but haven't succeed yet. What I'm…
Hemang
  • 26,840
  • 19
  • 119
  • 186
0
votes
1 answer

How to convert timeIntervalSinceNow in swift to a readable date

Hi I am trying to find the time interval between a certain date to the current local time. var a = eventDate.timeIntervalSinceNow println(a) //1404567.32182503 - output When I try to do that I am getting the output as mentioned above. How can I…
AAA
  • 1,957
  • 4
  • 23
  • 42
0
votes
1 answer

IOS - Make background fetch Occurs only once a day (No need for specific time)

I'm using background fetch to schedule task. If i understood correctly background fetch happens many times during the day. I need to limit it to occur only one time during the day. Everything is set up correctly,For now i have setted (as a temp…
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
0
votes
2 answers

NSTimer giving inexact results

I have a camera app where I am trying to limit the capture length to exactly 15 seconds. I have tried two different approaches, and neither of them are working to my satisfaction. The first approach is to fire a repeating timer every…
jesses.co.tt
  • 2,689
  • 1
  • 30
  • 49
0
votes
2 answers

In iOS, Why [[NSDate date]timeIntervalSince1970] is double internally? It should be long long though

In iOS SDK, I observed that [[NSDate date]timeIntervalSince1970] returns NSTimeInterval which is double internally. Ideally shouldn't it be long long?
Krupal Ghorpade
  • 137
  • 1
  • 15
0
votes
1 answer

Default NSTimeInterval used by CoreData

NSDate value is returned by CloudKit. Which representation will system choose, when I am storing date in Core Data as NSTimeInterval? I know NSTimeInterval stores number of seconds since some specific reference date. But which reference date will be…
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
1 answer

timeIntervalSinceDate reporting wrong value

I've got two dates that are set with a button press. These are stored in a custom object that inherits from NSObject. Properties: @property (nonatomic, strong) NSDate *firstDate; @property (nonatomic, strong) NSDate *secondDate; Custom getter and…
Erik
  • 2,500
  • 6
  • 28
  • 49