- Timestamp:
- 09/17/11 15:19:05 (8 months ago)
- Branch:
- default
- Convert:
- svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2775
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kraken-ntp/src/main/java/org/krakenapps/ntp/script/NtpScript.java
r274 r341 25 25 import org.krakenapps.api.ScriptContext; 26 26 import org.krakenapps.api.ScriptUsage; 27 import org.krakenapps.ntp.Ntp Client;27 import org.krakenapps.ntp.NtpSyncService; 28 28 29 29 /** … … 32 32 public class NtpScript implements Script { 33 33 private ScriptContext context; 34 private Ntp Client ntpClient;34 private NtpSyncService syncService; 35 35 36 public NtpScript(Ntp Client ntpClient) {37 this. ntpClient = ntpClient;36 public NtpScript(NtpSyncService syncService) { 37 this.syncService = syncService; 38 38 } 39 39 … … 49 49 try { 50 50 InetAddress server = InetAddress.getByName(args[0]); 51 ntpClient.setTimeServer(server);51 syncService.setTimeServer(server); 52 52 } catch (UnknownHostException e) { 53 53 context.println("unknown host"); … … 55 55 } 56 56 57 context.println( ntpClient.getTimeServer());57 context.println(syncService.getTimeServer()); 58 58 } 59 59 … … 63 63 if (args.length > 0) { 64 64 Integer millisecond = Integer.parseInt(args[0]); 65 ntpClient.setTimeout(millisecond);65 syncService.setTimeout(millisecond); 66 66 } 67 67 68 context.println( ntpClient.getTimeout());68 context.println(syncService.getTimeout()); 69 69 } 70 70 71 71 public void sync(String[] args) { 72 Date result = ntpClient.sync();72 Date result = syncService.getNtpClient().sync(); 73 73 if (result != null) 74 context.printf("The time has been successfully synchronized with %s on %s\n", ntpClient.getTimeServer()74 context.printf("The time has been successfully synchronized with %s on %s\n", syncService.getTimeServer() 75 75 .getHostName(), new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS 'UTC'").format(result)); 76 76 else
Note: See TracChangeset
for help on using the changeset viewer.
