Here you can find the source of marsTimeFromElapsedMillis(long elapsedMillis, int[] marsTime)
private static void marsTimeFromElapsedMillis(long elapsedMillis, int[] marsTime)
//package com.java2s; /** /* ww w . j av a 2 s . com*/ * Midnight Mars Browser - http://midnightmarsbrowser.blogspot.com * Copyright (c) 2005 by Michael R. Howard * * Midnight Mars Browser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Midnight Mars Browser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Midnight Mars Browser; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ public class Main { /** * Calculate the local Mars time from the number of milliseconds since * the start of Sol 1. */ private static void marsTimeFromElapsedMillis(long elapsedMillis, int[] marsTime) { double marsDaySecs = (double) 35.244 + (double) 24 * 60 * 60 + 39 * 60; double solDouble = ((double) (elapsedMillis / 1000)) / marsDaySecs; double hourDouble = (solDouble - ((long) solDouble)) * 24; double minuteDouble = (hourDouble - ((long) hourDouble)) * 60; double secondDouble = (minuteDouble - ((long) minuteDouble)) * 60; int sol = (int) (solDouble) + 1; int hour = (int) (hourDouble); int minute = (int) (minuteDouble); int second = (int) (secondDouble); marsTime[0] = sol; marsTime[1] = hour; marsTime[2] = minute; marsTime[3] = second; } }