我有以下功能:
function timestamp(duration)
local hours = duration / 3600
local minutes = duration % 3600 / 60
local seconds = duration % 60
return string.format("%02d:%02d:%02.03f", hours, minutes, seconds)
end
当持续时间为4.404秒时,它返回00:00:4.404
我们正在寻找的是00:00:04.404
答案 0 :(得分:3)
应该是:
let fileURL = try! FileManager.default.url(for: .desktopDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
Process.launchedProcess(launchPath: "/usr/sbin/screencapture", arguments: [fileURL.appendingPathComponent("screenshot.jpg").path])
字段宽度包含该数字的所有字符,包括 point 和分数。