Skip to content

Commit

Permalink
commit a collect of adjustments to 'clock quality' rules that have be…
Browse files Browse the repository at this point in the history
…en sitting around for a while ..
  • Loading branch information
gavineadie committed May 13, 2016
1 parent 3b08eb5 commit a607b2b
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 52 deletions.
6 changes: 0 additions & 6 deletions ios-ntp-app/ntpAppDelegate.m
Expand Up @@ -14,10 +14,4 @@ - (BOOL) application:(UIApplication *) app didFinishLaunchingWithOptions:(NSDict

}

- (void)applicationWillTerminate:(UIApplication *) app {

// [[NetworkClock sharedNetworkClock] finishAssociations]; // be nice and let all the servers go ...

}

@end
13 changes: 6 additions & 7 deletions ios-ntp-lib/NSDate+NetworkClock.h
@@ -1,12 +1,11 @@

// Author: Juan Batiz-Benet

// Category on NSDate to provide convenience access to NetworkClock.
// To use, simply call [NSDate networkDate];
/*╔══════════════════════════════════════════════════════════════════════════════════════════════════╗
║ Author: Juan Batiz-Benet ║
║ ║
║ Category on NSDate to provide convenience access to NetworkClock. ║
║ To use, simply call [NSDate networkDate]; ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════╝*/

#import <Foundation/Foundation.h>
#import "NetworkClock.h"


@interface NSDate (NetworkClock)

Expand Down
6 changes: 4 additions & 2 deletions ios-ntp-lib/NSDate+NetworkClock.m
@@ -1,6 +1,9 @@

/*╔══════════════════════════════════════════════════════════════════════════════════════════════════╗
║ Author: Juan Batiz-Benet ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════╝*/

#import "NSDate+NetworkClock.h"
#import "NetworkClock.h"

@implementation NSDate (NetworkClock)

Expand All @@ -24,5 +27,4 @@ + (NSDate *) threadsafeNetworkDate {
}
}


@end
18 changes: 15 additions & 3 deletions ios-ntp-lib/NetAssociation.h
Expand Up @@ -37,7 +37,6 @@
│ | 15.3 microseconds (mask = 0xffff0000) │
│ 3.9 milliseconds (mask = 0xff000000) │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘*/

#define JAN_1970 ((uint64_t)0x83aa7e80) // UNIX epoch in NTP's epoch:
Expand Down Expand Up @@ -80,11 +79,24 @@ double ntpDiffSeconds(union ntpTime * start, union ntpTime * stop);
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛*/
- (instancetype) initWithServerName:(NSString *) serverName NS_DESIGNATED_INITIALIZER;

- (void) enable;
- (void) finish;
/*┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ empty the time values fifo and start the timer which queries the association's server .. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛*/
- (void) enable; // ..
/*┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ snooze: stop the timer in a way that let's start it again .. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛*/
- (void) snooze; // stop the timer but don't delete it
/*┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ finish: stop the timer and invalidate it .. it'll die and disappear .. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛*/
- (void) finish; // ..

- (void) sendTimeQuery; // send one datagram to server ..

/*┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ utility method converts domain name to numeric dotted address string .. ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛*/
+ (NSString *) ipAddrFromName: (NSString *) domainName;

@end

0 comments on commit a607b2b

Please sign in to comment.