Changeset 347 in tmcsimulator for trunk/src/tmcsim/cadsimulator/Coordinator.java
- Timestamp:
- 03/25/2019 07:35:45 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/tmcsim/cadsimulator/Coordinator.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/cadsimulator/Coordinator.java
r310 r347 2 2 3 3 import java.io.File; 4 import java.io.FileWriter; 5 import java.io.PrintWriter; 4 6 import java.rmi.RemoteException; 5 7 import java.rmi.server.UnicastRemoteObject; … … 68 70 import tmcsim.interfaces.CoordinatorInterface; 69 71 import tmcsim.interfaces.SimulationManagerInterface; 72 import tmcsim.simulationmanager.SimulationManagerView; 70 73 71 74 /** … … 90 93 { 91 94 /** 95 * The name of the file where the simulation clock time is written 96 */ 97 public static final String kSimClockFilename = "webapps/sim_clock.json"; 98 /** 92 99 * Error logger. 93 100 */ … … 700 707 701 708 CADServer.theIncidentMgr.tick(currentSimTime); 702 } 709 /* Write the currentSimTime to a file. 710 This will be read asynchronously by web clients, e.g., 711 the electronic instructor notebook, that want to display 712 the current simulation time. 713 */ 714 PrintWriter writer = null; 715 try { 716 writer = new PrintWriter(new FileWriter(kSimClockFilename)); 717 // Format output as json 718 String lineout = "{\"clock\":\"" 719 + SimulationManagerView.longToTime(currentSimTime) + "\"}"; 720 writer.println(lineout); 721 writer.close(); 722 } catch (Exception ex) 723 { 724 coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 725 "Failed to write current sim time to file.", ex); 726 } 727 } 703 728 }; 704 729
Note: See TracChangeset
for help on using the changeset viewer.
