File: lfstest-nanomtime.go

package info (click to toggle)
git-lfs 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,808 kB
  • sloc: sh: 21,256; makefile: 507; ruby: 417
file content (23 lines) | stat: -rw-r--r-- 393 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//go:build testtools
// +build testtools

package main

import (
	"fmt"
	"os"
)

func main() {
	if len(os.Args) < 2 {
		fmt.Fprintf(os.Stderr, "Need an argument")
		os.Exit(2)
	}
	st, err := os.Stat(os.Args[1])
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to stat %q: %s", os.Args[1], err)
		os.Exit(3)
	}
	mtime := st.ModTime()
	fmt.Printf("%d.%09d", mtime.Unix(), mtime.Nanosecond())
}