formatLyricTimeStr static method

String formatLyricTimeStr(
  1. double in_second
)
  • in_second 转为 HH:MM:SS.(MS/10) 时间格式字符串
  • in_second 的单位:秒 s
  • 注意:
    • 毫秒部分会除以10显示

Implementation

static String formatLyricTimeStr(double in_second) {
  if (in_second > 0) {
    var minute = in_second ~/ 60;
    var second = in_second.toInt() % 60;
    var msecond = in_second * 1000 % 1000 ~/ 10;
    String restr = "";
    if (minute < 10) {
      restr += "0";
    }
    restr += "$minute:";
    if (second < 10) {
      restr += "0";
    }
    restr += "$second.";
    if (msecond < 10) {
      restr += "0";
    }
    restr += msecond.toString();
    return restr;
  } else {
    return "00:00.00";
  }
}