Here you can find the source of formatTimeSecondsSinceEpoch(final long time, StringBuilder sbuffer)
Parameter | Description |
---|---|
time | the time as milliseconds since epoch |
sbuffer | a StringBuilder used to put the formatted number into |
public static void formatTimeSecondsSinceEpoch(final long time, StringBuilder sbuffer)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w ww . j a v a2 s . c o m*/ * Convert timestamp to seconds since epoch with 3 decimal places. * * @param time the time as milliseconds since epoch * @param sbuffer a StringBuilder used to put the formatted number into */ public static void formatTimeSecondsSinceEpoch(final long time, StringBuilder sbuffer) { String timeString = Long.toString(time); int len = timeString.length(); if (len < 3) { // Something wrong. Handle it by just returning the input // long as a string. We prefer this to just crashing in the // substring handling. sbuffer.append(timeString); return; } sbuffer.append(timeString.substring(0, len - 3)); sbuffer.append('.'); sbuffer.append(timeString.substring(len - 3)); } }