How do you get a set of time marks every half a second?
-
There's a need, a set of time marks, every half seconds.
How do you do that?
I mean, the mass should contain lines of this kind of "18:20:53.500."
172,800 lines last 24 hours.
public class ArrayOfTimeLabels { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here }
List<String> getDataX() { List<String> data = new CopyOnWriteArrayList(); return data; }
}
To better understand that I want that DataGenerator.
He's the only one starting to work from now on.
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Date;
import java.util.concurrent.CopyOnWriteArrayList;/**
*-
@author ALEXANDER
*/
public class DataGenerator {
static SimpleDateFormat sdf;
static Date date = null;static List<Date> getListDate(int numPoints) throws ParseException {
//System.out.println(sdf.format(date));
//sdf = new SimpleDateFormat("HH:mm:ss");//List<Date> data = new CopyOnWriteArrayList<Date>(); List<Date> data = new CopyOnWriteArrayList(); for (int i = 0; i < numPoints; i++) { sdf = new SimpleDateFormat("HH:mm:ss.S"); Date now = new Date(); String strDate = sdf.format(now); System.err.println(strDate); data.add(sdf.parse(strDate)); } return data;
}
static List<Double> getListRandomData(int numPoints) {
List<Double> data = new CopyOnWriteArrayList<Double>(); for (int i = 0; i < numPoints; i++) { data.add(Math.random() * 100); } return data;
}
}
-
-
truncateTo in this case will cut everything until today, and you'll be able to have the current day with the time of "00:00.000."
Instant instant = Instant.now().truncatedTo(ChronoUnit.DAYS); for (int i = 0; i < 172800; i++) { instant = instant.plus(500, ChronoUnit.MILLIS); saveFormattedInstant(instant); }