mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 06:50:06 +00:00 
			
		
		
		
	NTP polling
This commit is contained in:
		
							parent
							
								
									258466e02c
								
							
						
					
					
						commit
						dfb00b96df
					
				
					 3 changed files with 281 additions and 32 deletions
				
			
		|  | @ -11,10 +11,24 @@ TEST(NtpClient, Poll) | |||
| { | ||||
|    NtpClient client {}; | ||||
| 
 | ||||
|    client.Open("time.nist.gov", "123"); | ||||
|    //client.Open("pool.ntp.org", "123");
 | ||||
|    //client.Open("time.windows.com", "123");
 | ||||
|    client.Poll(); | ||||
|    const std::string firstServer   = client.RotateServer(); | ||||
|    std::string       currentServer = firstServer; | ||||
|    std::string       lastServer    = firstServer; | ||||
|    bool              error         = false; | ||||
| 
 | ||||
|    do | ||||
|    { | ||||
|       client.RunOnce(); | ||||
|       error = client.error(); | ||||
| 
 | ||||
|       EXPECT_EQ(error, false); | ||||
| 
 | ||||
|       // Loop until the current server repeats the first server, or fails to
 | ||||
|       // rotate
 | ||||
|       lastServer    = currentServer; | ||||
|       currentServer = client.RotateServer(); | ||||
|    } while (currentServer != firstServer && currentServer != lastServer && | ||||
|             !error); | ||||
| } | ||||
| 
 | ||||
| } // namespace network
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat