Java Milliseconds filetimeToMillis(long filetime)

Here you can find the source of filetimeToMillis(long filetime)

Description

Converts a 64-bit NTFS time value (number of 100-nanosecond intervals since January 1, 1601 UTC) to a Java time value (number of milliseconds since January 1, 1970 UTC.)

License

Open Source License

Parameter

Parameter Description
filetime the FILETIME value.

Return

the number of milliseconds since 1970.

Declaration

public static long filetimeToMillis(long filetime) 

Method Source Code

//package com.java2s;
/*//from   ww w.  j a v  a2  s . com
 * $Id$
 *
 * Copyright (C) 2003-2015 JNode.org
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library 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 Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; If not, write to the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

public class Main {
    /**
     * Converts a 64-bit NTFS time value (number of 100-nanosecond intervals since January 1, 1601 UTC)
     * to a Java time value (number of milliseconds since January 1, 1970 UTC.)
     *
     * @param filetime the FILETIME value.
     * @return the number of milliseconds since 1970.
     */
    public static long filetimeToMillis(long filetime) {
        // Move the starting epoch to January 1, 1970.
        filetime -= 116444736000000000L;

        // Now convert the time into milliseconds, rather than 100-nanosecond units.
        if (filetime < 0) {
            filetime = -1 - ((-filetime - 1) / 10000);
        } else {
            filetime = filetime / 10000;
        }
        return filetime;
    }
}

Related

  1. elapsedMillis(long milliseconds)
  2. elapsedMillis(long startTime)
  3. elapsedMillis(long t0nanos, long t1nanos)
  4. ensureSleepMillis(long millis)
  5. expensiveMethodTakingMillis(final int millis)
  6. fractionOfDayToMilliseconds(float fFractionOfDay)
  7. getDurationFromMillis(final long millis)
  8. getDurationSecFromMillisDouble(long millis)
  9. getExpirationInMilliSeconds(long currentTime, int expirationTime)