@Test public void testGetTimeBucket() { long timestamp = System.currentTimeMillis(); int timeBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, timestamp, 3600); assertEquals(((timestamp / 1000) / 3600) * 3600, timeBucket); }
public static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds) throws IllegalArgumentException { int ts = timeToSeconds(unit, timestamp); return getWindowFlooredNaturalTime(ts, bucketSizeInSeconds); }
TimeUtils { public static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds) throws IllegalArgumentException { int ts = timeToSeconds(unit, timestamp); return getWindowFlooredNaturalTime(ts, bucketSizeInSeconds); } }
TimeUtils { public static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds) throws IllegalArgumentException { int ts = timeToSeconds(unit, timestamp); return getWindowFlooredNaturalTime(ts, bucketSizeInSeconds); } private  TimeUtils(); }
TimeUtils { public static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds) throws IllegalArgumentException { int ts = timeToSeconds(unit, timestamp); return getWindowFlooredNaturalTime(ts, bucketSizeInSeconds); } private  TimeUtils(); static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds); static int getWindowFlooredBinaryTime(TimeUnit unit, long timestamp, int windowSizeInSeconds); static int timeToSeconds(TimeUnit unit, long time); static int timeToMilliSeconds(TimeUnit unit, long time); static long timeToNanoSeconds(TimeUnit unit, long time); static int getWindowFlooredNaturalTime(int timeInSeconds, int bucketInSeconds); static long getTimeFromBucketString(String hexTimeInSeconds); static long getTimeFromBucketString(int timeInSeconds); }
TimeUtils { public static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds) throws IllegalArgumentException { int ts = timeToSeconds(unit, timestamp); return getWindowFlooredNaturalTime(ts, bucketSizeInSeconds); } private  TimeUtils(); static int getTimeBucket(TimeUnit unit, long timestamp, int bucketSizeInSeconds); static int getWindowFlooredBinaryTime(TimeUnit unit, long timestamp, int windowSizeInSeconds); static int timeToSeconds(TimeUnit unit, long time); static int timeToMilliSeconds(TimeUnit unit, long time); static long timeToNanoSeconds(TimeUnit unit, long time); static int getWindowFlooredNaturalTime(int timeInSeconds, int bucketInSeconds); static long getTimeFromBucketString(String hexTimeInSeconds); static long getTimeFromBucketString(int timeInSeconds);  }