wcf.regNote.message
Quoted
Original von CiL
Also eigentlich sollte das über die Klasse Date machbar sein, da gibt es zumindest set-Funktionen, aber ob das auf die HW-Clock geschrieben wird weiss ich nicht.
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import java.io.*;
import java.util.*;
class TManipulator extends Thread
{
private int Intervall;
private int Manipulation;
private boolean Stop = false;
public TManipulator(int Intervall, int Manipulation)
{
this.Intervall = Intervall;
this.Manipulation = Manipulation;
}
public void run()
{
Runtime rt = Runtime.getRuntime();
GregorianCalendar cal = new GregorianCalendar();
long MillisNeu;
while (!Stop)
{
try {
MillisNeu = System.currentTimeMillis() - Manipulation;
cal.setTimeInMillis(MillisNeu);
rt.exec("cmd.exe /C time " + cal.get(Calendar.HOUR_OF_DAY) + "." + cal.get(Calendar.MINUTE) + "." + cal.get(Calendar.SECOND) + "." + cal.get(Calendar.MILLISECOND) / 10);
}
catch(IOException ex) {
Stop = true;
}
try {
sleep(Intervall);
}
catch (InterruptedException ex) {
// Nichts
}
}
}
public void setStop(boolean Stop) {
this.Stop = Stop;
}
}
|