Browse Source

Initial commit

Eliezer Croitoru 3 months ago
commit
58b3817423
2 changed files with 46 additions and 0 deletions
  1. 10 0
      LICENSE
  2. 36 0
      main.go

File diff suppressed because it is too large
+ 10 - 0
LICENSE


+ 36 - 0
main.go

@@ -0,0 +1,36 @@
+package main
+
+import (
+	"fmt"
+	"time"
+	"bufio"
+	"os"
+	"strconv"
+)
+
+func main() {
+	reader := bufio.NewReader(os.Stdin)
+//	fmt.Print("Enter text: ")
+	nano, _ := reader.ReadString('\n')
+/*	tNow := time.Now()
+	fmt.Println("time.Now() = ", tNow)
+
+	tNano := tNow.UnixNano()
+	fmt.Println("time.Now().UnixNano() = ", tNano)
+
+	tNew := time.Unix(0, tNano)
+
+	fmt.Println("tNew = ", tNew)
+*/
+	tNano, err := strconv.ParseInt(nano[:len(nano)-1], 10, 64)
+	if err != nil {
+	    panic(err)
+	}
+//	fmt.Printf("Hello, %v with type %s!\n", i, reflect.TypeOf(i))
+	nanotime := time.Unix(0, tNano)
+
+	fmt.Println("nano from stdin = ", nanotime)
+
+	//	fmt.Println(tNow.Equal(tNew))
+}
+