Android ID Generate generateSyncEventId()

Here you can find the source of generateSyncEventId()

Description

generate Sync Event Id

Declaration

public synchronized static String generateSyncEventId() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    static long sequence = 0;

    public synchronized static String generateSyncEventId() {
        if (sequence == Long.MAX_VALUE)
            sequence = 0;/* w w w  . j  a  v  a2 s .  co  m*/

        return convertLongToDateString(System.currentTimeMillis(),
                "yyyy-MM-dd hh:mm:ss")
                + "-"
                + String.format("%20d", sequence++);
    }

    public static String convertLongToDateString(long mills, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);

        String date = sdf.format(mills);

        return date;
    }
}

Related

  1. getSequenceId()
  2. generateId(Object... value)
  3. generateId(Object... value)
  4. generateRecordingIdentifier()