Java Long Number Align alignQueryTimestampToBaseAggregationTime(long queryTimestamp)

Here you can find the source of alignQueryTimestampToBaseAggregationTime(long queryTimestamp)

Description

align Query Timestamp To Base Aggregation Time

License

Open Source License

Declaration

public static long alignQueryTimestampToBaseAggregationTime(long queryTimestamp) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public final static int AGGREGATION_TIME_INTERVAL = 60;

    public static long alignQueryTimestampToBaseAggregationTime(long queryTimestamp) {
        if (isBaseAggregationTimestamp(queryTimestamp)) {
            return queryTimestamp;
        } else {//from  ww w  .jav a 2  s  .  c o m
            return queryTimestamp - queryTimestamp % AGGREGATION_TIME_INTERVAL;
        }
    }

    public static boolean isBaseAggregationTimestamp(long timestamp) {
        return timestamp % AGGREGATION_TIME_INTERVAL == 0;

    }
}

Related

  1. align(long value, int al)
  2. align(long value, long alignment)
  3. alignDown(long value, long granularity)
  4. alignLength(int sectorSize, long remoteOffset, long len)
  5. alignOffset(int sectorSize, long fileOffset)
  6. alignSize(long size)
  7. alignSize(long size, long alignment)
  8. alignUp(long b, long a)