// Path: src/main/java/bdsup2sub/utils/ToolBox.java
// public static String leftZeroPad(int value, int width) {
//     return String.format("%0" + width + "d", value);
// }


import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static bdsup2sub.utils.ToolBox.leftZeroPad;
/*
 * Copyright 2014 Volker Oth (0xdeadbeef) / Miklos Juhasz (mjuhasz)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package bdsup2sub.utils;



public class TimeUtils {

    private static final int PTS_FREQUENCY_IN_KHZ = 90;
    private static final Pattern TIME_PATTERN = Pattern.compile( "(\\d+):(\\d+):(\\d+)[:\\.](\\d+)" );

    public static String ptsToTimeStr(long pts) {
        int time[] = ptsToTime(pts);
        return leftZeroPad(time[0], 2) + ":" + leftZeroPad(time[1], 2) + ":" + leftZeroPad(time[2], 2) + "." + leftZeroPad(time[3], 3);
    }

    public static String ptsToTimeStrIdx(long pts) {
        int time[] = ptsToTime(pts);
// Path: src/main/java/bdsup2sub/utils/ToolBox.java
// public static String leftZeroPad(int value, int width) {
//     return String.format("%0" + width + "d", value);
// }


// Path: src/main/java/bdsup2sub/utils/TimeUtils.java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static bdsup2sub.utils.ToolBox.leftZeroPad;

/*
 * Copyright 2014 Volker Oth (0xdeadbeef) / Miklos Juhasz (mjuhasz)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package bdsup2sub.utils;



public class TimeUtils {

    private static final int PTS_FREQUENCY_IN_KHZ = 90;
    private static final Pattern TIME_PATTERN = Pattern.compile( "(\\d+):(\\d+):(\\d+)[:\\.](\\d+)" );

    public static String ptsToTimeStr(long pts) {
        int time[] = ptsToTime(pts);
        return leftZeroPad(time[0], 2) + ":" + leftZeroPad(time[1], 2) + ":" + leftZeroPad(time[2], 2) + "." + leftZeroPad(time[3], 3);
    }

    public static String ptsToTimeStrIdx(long pts) {
        int time[] = ptsToTime(pts);
        return leftZeroPad(time[0], 2) + ":" + leftZeroPad(time[1], 2) + ":" + leftZeroPad(time[2], 2) + ":" + leftZeroPad(time[3], 3);