/* * This file is part of the Remote Sensor Actuator Interface (ReSAI). * * Copyright(c) Andreas Kipp, Frederic Siepmann * http://opensource.cit-ec.de/projects/resai * * This file may be licensed under the terms of of the * GNU Lesser General Public License Version 3 (the ``LGPL''), * or (at your option) any later version. * * Software distributed under the License is distributed * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the LGPL for the specific language * governing rights and limitations. * * You should have received a copy of the LGPL along with this * program. If not, go to http://www.gnu.org/licenses/lgpl.html * or write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The development of this software was supported by the * Excellence Cluster EXC 277 Cognitive Interaction Technology. * The Excellence Cluster EXC 277 is a grant of the Deutsche * Forschungsgemeinschaft (DFG) in the context of the German * Excellence Initiative. * */ /** * Helper to translate time data. * * @author akipp */ package de.unibi.airobots.resaijavaclient.helper; import java.text.DateFormat; import java.text.SimpleDateFormat; public class TimeConverter { /** * Parse given time from long to String * @param time given milliseconds * @return time parsed from long */ public static String toTime(long time) { DateFormat df = DateFormat.getTimeInstance(); String logEntry = df.format(time); return logEntry; } /** * Parse given time from long to String * @param time given milliseconds * @return date parsed from long */ public static String toDateTime(long time) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); String logEntry = df.format(time); return logEntry; } }