Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6890221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:15:16+00:00 2026-05-27T06:15:16+00:00

Can anybody help me by answering how to get system time in GO. For

  • 0

Can anybody help me by answering how to get system time in GO. For example, in the below code, I want to know when the first print and second print statements are executed and what is the time difference between them.

package main

import "fmt"

func main() {
fmt.Println("Hello, 世界")
    fmt.Println("Hello, 世界")
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:15:17+00:00Added an answer on May 27, 2026 at 6:15 am

    See the time package. Documentation can be found at http://golang.org/pkg/time/

    For getting the nanoseconds-time before, after the first and after the last of your statements, and then printing them out:

    package main
    
    import "fmt"
    import "time"
    
    func main() {
      i1 := time.Nanoseconds();
      fmt.Println("Hello, 世界")
      i2 := time.Nanoseconds();
      fmt.Println("Hello, 世界")
      i3 := time.Nanoseconds();
      fmt.Println("Check this out!")
      fmt.Println(i1)
      fmt.Println(i2)
      fmt.Println(i3)
      fmt.Println(time.NanosecondsToLocalTime(i1).Format(time.StampNano))
      fmt.Println(time.NanosecondsToLocalTime(i2).Format(time.StampNano))
      fmt.Println(time.NanosecondsToLocalTime(i3).Format(time.StampNano))
    }
    

    In my VM, I then get the following results:

    ~/dev/go/test $ nano test.go
    ~/dev/go/test $ 6g test.go; 
    ~/dev/go/test $ 6l test.6
    ~/dev/go/test $ ./6.out
    Hello, 世界
    Hello, 世界
    Check this out!
    1322386593830456000
    1322386593830498000
    1322386593830501000
    Nov 27 10:36:33.830456000
    Nov 27 10:36:33.830498000
    Nov 27 10:36:33.830501000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody help me in this? I want to get an screenshot from an
Can anybody help me how to arrange StandardTitlebar elements,for example I want battery indicator
Can anybody help me letting me know what is wrong with the following code?
Can anybody help me resolve the problem for posting multipart/form-data using below code. I
Can anybody help me with retrieving some elements from the following example text: sdfaasdflj
Can anybody help me with this simple code?? #include <iostream> using namespace std; void
Can anybody help me out, I'm stuck, don't know how to write a php
Can anybody help me? How can I read only first row from an Excel
can anybody help with the code on how to add segmented control within the
Can anybody help me oput by letting me know the taglib uri for JSTL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.