#apply
#include "../_include.txt"

/*
@param
タイプ(0 : hh;mm;ss 1 : mm:ss 2 : hh:mm)
代入先の文字列変数
フレーム数
*/
cev[CEV_GET_TIMER_STRING] .name(">>>>タイマー文字列を取得する") {
    defv {
        a_type = TV_GET_TIMER_STRING
        a_pos
        a_frame
        
        milliseconds
        seconds
        minutes
        hours

        dg1
        dg2
        dg3
        dg4
        dg5
        dg6
        dg7
        dg8
    }

    milliseconds = (a_frame % UNIT_FPS) * 100 / UNIT_FPS
    seconds      = (a_frame / UNIT_FPS) % 60
    minutes      = (a_frame / (UNIT_FPS * 60)) % 60
    hours        = (a_frame / (UNIT_FPS * 60 * 60))

    dg1 = seconds % 10
    dg2 = seconds / 10
    dg3 = minutes % 10
    dg4 = minutes / 10
    dg5 = hours % 10
    dg6 = hours / 10
    dg7 = milliseconds % 10
    dg8 = milliseconds / 10

    //mm:ss
    @if a_type == 1 bl {
        t[a_pos].asg(__str("\", dg4, "\", dg3, ":\", dg2, "\", dg1) .extract)
    //hh:mm
    } .elif a_type == 2 bl {
        t[a_pos].asg(__str("\", dg6, "\", dg5, ":\", dg4, "\", dg3) .extract)
    //mm:ss:ms
    } .elif a_type == 3 bl {
        t[a_pos].asg(__str("\", dg4, "\", dg3, ":\", dg2, "\", dg1, ":\", dg8, "\", dg7) .extract)
    //hh:mm:ss
    } .else bl {
        t[a_pos].asg(__str("\", dg6, "\", dg5, ":\", dg4, "\", dg3, ":\", dg2, "\", dg1) .extract)
    }
}