-
public class TimestampUtilsFuji ** Reve Systems * 2022 * This class helps to transport timstamps through network optimizedly, it also helps to convert necessary format whenever we need
-
-
Field Summary
Fields Modifier and Type Field Description public final longMEETING_START_TIME
-
Constructor Summary
Constructors Constructor Description TimestampUtils(long meetingStartTime)
-
Method Summary
Modifier and Type Method Description longreferenceEncode(long t64)we will substract the meeting starting time from current time and send that value to network to make thetimestamp shorterassuming that the difference won't be longer than 4 byteunsigned 4 byte = (2^32) - 1 = 4294967295 (millis) = 49. longreferenceDecode(long t32)we will add meeting starting time to the time we got from network to get the actual timestamp static StringgetFormattedDateTime(long millis)static longgetMillis(String formattedDate)static StringgetGmtDate(long millis)static voidmain(Array<String> args)-
-
Method Detail
-
referenceEncode
long referenceEncode(long t64)
we will substract the meeting starting time from current time and send that value to network to make thetimestamp shorterassuming that the difference won't be longer than 4 byteunsigned 4 byte = (2^32) - 1 = 4294967295 (millis) = 49.7 daysunsigned 4 byte because we are using long and before sending to network we just simply reading 4 bytes, byusing this technique we can make use of 32nd bit (signed bit) for data
- Parameters:
t64- is the current time in long (8 bytes)
-
referenceDecode
long referenceDecode(long t32)
we will add meeting starting time to the time we got from network to get the actual timestamp
- Parameters:
t32- is the long (4 bytes) version of current time
-
getFormattedDateTime
static String getFormattedDateTime(long millis)
- Parameters:
millis- is timestamp in milli seconds
-
getMillis
static long getMillis(String formattedDate)
- Parameters:
formattedDate- is the predefined formatted input which express clearly ay/month/hour/min/secs/millis/time-zone
-
getGmtDate
@RequiresApi(api = Build.VERSION_CODES.N) static String getGmtDate(long millis)
-
-
-
-