Here you can find the source of convertTimecodeToSeconds(String timecode)
Parameter | Description |
---|---|
timecode | a parameter |
public static float convertTimecodeToSeconds(String timecode)
//package com.java2s; /*//from w w w.ja v a 2 s. c om * Copyright (C) 2005-2014 Alfresco Software Limited. * * This file is part of Gytheio * * Gytheio 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 3 of the License, or * (at your option) any later version. * * Gytheio 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 Gytheio. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Converts the given timecode string of the form "HH:mm:ss[.SSS]" to the * total number of seconds it represents * * @param timecode * @return the total number of seconds */ public static float convertTimecodeToSeconds(String timecode) { String[] timeParts = timecode.split(":"); int hours = Integer.parseInt(timeParts[0]); int minutes = Integer.parseInt(timeParts[1]); float seconds = Float.parseFloat(timeParts[2]) + (60 * minutes) + (60 * 60 * hours); return seconds; } }