List of usage examples for java.util.concurrent TimeUnit DAYS
TimeUnit DAYS
To view the source code for java.util.concurrent TimeUnit DAYS.
Click Source Link
From source file:Main.java
public static void main(String[] args) { TimeUnit tu = TimeUnit.DAYS; System.out.println(tu.toDays(1)); System.out.println(tu.toHours(1)); System.out.println(tu.toMillis(1)); }
From source file:Main.java
public static void main(String[] args) { TimeUnit tu = TimeUnit.DAYS; System.out.println(tu.toDays(1)); System.out.println(tu.toHours(1)); System.out.println(tu.toNanos(1)); }
From source file:Main.java
public static void main(String[] args) { TimeUnit tu = TimeUnit.DAYS; System.out.println(tu.toDays(1)); System.out.println(tu.toHours(1)); System.out.println(tu.toMicros(1)); }
From source file:Main.java
public static void main(String[] args) { TimeUnit tu = TimeUnit.DAYS; System.out.println(tu.toDays(1)); System.out.println(tu.toHours(1)); System.out.println(tu.toSeconds(1)); }
From source file:TimeUnitDemo.java
public static void main(String[] args) { TimeUnit tu = TimeUnit.DAYS; System.out.println(tu.toDays(1)); System.out.println(tu.toHours(1)); System.out.println(tu.toMinutes(1)); }
From source file:Main.java
public static void main(String[] args) throws Exception { TimeUnit timeUnit = TimeUnit.valueOf(TimeUnit.DAYS.name()); System.out.println(timeUnit); }
From source file:Main.java
public static void main(String[] args) { Calendar first = Calendar.getInstance(); first.set(2008, Calendar.AUGUST, 1); Calendar second = Calendar.getInstance(); System.out.println(getDifference(first, second, TimeUnit.DAYS) + " day(s) between "); }
From source file:ddf.metrics.reporting.internal.rrd4j.RrdDumper.java
public static void main(String[] args) throws Exception { // String rrdFilename = args[0]; String[] rrdFilenames = new String[] { "C:/DDF/jvmUptime.rrd" }; for (String rrdFilename : rrdFilenames) { RrdDb rrdDb = new RrdDb(rrdFilename, true); long endTime = System.currentTimeMillis() / 1000; long duration = TimeUnit.SECONDS.convert(24L, TimeUnit.DAYS); long startTime = endTime - duration; ///*from w w w . j a v a 2 s. co m*/ // Calendar cal = Calendar.getInstance(); // cal.set(2013, 7, 21, 15, 40); // long startTime = cal.getTimeInMillis()/1000; // cal.set(2013, 7, 22, 8, 0); // long endTime = cal.getTimeInMillis()/1000; System.out.println( "\n\n>>>>>>>>>>>>>>>>>>> RRD File: " + rrdFilename + " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n"); dumpData(ConsolFun.TOTAL, "TOTAL", rrdDb, "COUNTER", startTime, endTime); displayGraph("Metric Name", rrdFilename, startTime, endTime, "Y-Axis Label", "Graph Title"); } }
From source file:rtb.RandomTweetBotMain.java
public static void main(String[] args) { if (args.length != 1) { System.err.println("Usage: java -jar random-tweet-bot-<version>.jar <property_file_name>"); System.exit(1);/*from w w w. jav a 2s . co m*/ } System.setProperty("org.slf4j.simpleLogger.showDateTime", "true"); System.setProperty("org.slf4j.simpleLogger.dateTimeFormat", "[yyyy-MM-dd HH:mm:ss]"); BotProperties properties = new BotProperties(); try { properties.load(args[0]); } catch (IOException e) { e.printStackTrace(); } catch (ConfigurationException e) { e.printStackTrace(); } String filePath = properties.filePath(); List<String> screenNames = properties.screenName(); List<Integer> favThresholds = properties.favCount(); final long intervalMinutes = properties.intervalMinutes(); boolean reply = properties.reply(); PopularTweetCollector collector = new PopularTweetCollector(); RandomTweetBot bot = new RandomTweetBot(reply); Timer timer = new Timer(); TimerTask collectorTask = new PopularTweetCollectorTask(filePath, screenNames, favThresholds, collector); TimerTask botTask = new RandomTweetBotTask(filePath, bot); timer.scheduleAtFixedRate(collectorTask, 0L, TimeUnit.DAYS.toMillis(1L)); timer.scheduleAtFixedRate(botTask, TimeUnit.SECONDS.toMillis(3L), TimeUnit.MINUTES.toMillis(intervalMinutes)); }
From source file:org.jclouds.examples.blobstore.BlobUploaderMain.java
public static void main(String[] args) throws IOException { OptionParser parser = new OptionParser(); parser.accepts("directory").withRequiredArg().required().ofType(String.class); parser.accepts("provider").withRequiredArg().required().ofType(String.class); parser.accepts("username").withRequiredArg().required().ofType(String.class); parser.accepts("password").withRequiredArg().required().ofType(String.class); parser.accepts("region").withRequiredArg().required().ofType(String.class); parser.accepts("threads").withRequiredArg().ofType(Integer.TYPE).describedAs("number of parallel threads"); OptionSet options = null;/*w ww . ja va2 s . c o m*/ try { options = parser.parse(args); } catch (OptionException e) { System.out.println(e.getLocalizedMessage()); parser.printHelpOn(System.out); return; } if (options.has("threads")) { numThreads = Integer.valueOf((String) options.valueOf("numThreads")); } File rootDir = new File((String) options.valueOf("directory")); Collection<File> files = FileUtils.listFiles(rootDir, CanReadFileFilter.CAN_READ, TrueFileFilter.TRUE); totalBytes = FileUtils.sizeOfDirectory(rootDir); System.out.println("Uploading " + rootDir.getName() + " " + totalBytes / FileUtils.ONE_MB + "MB"); ExecutorService executor = Executors.newFixedThreadPool(numThreads); for (File f : files) { BlobUploader b = new BlobUploader((String) options.valueOf("username"), (String) options.valueOf("password"), (String) options.valueOf("provider"), (String) options.valueOf("region"), f); executor.execute(b); } executor.shutdown(); try { executor.awaitTermination(1, TimeUnit.DAYS); } catch (InterruptedException e) { e.printStackTrace(); } }