Getting a GMT_UNIX_time structure in Windows

This is a discussion on Getting a GMT_UNIX_time structure in Windows within the C++ Programming forums, part of the General Programming Boards category; I need to get the system time from a Windows machine in a certain format, namely the GMT_UNIX_time format which ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    124

    Getting a GMT_UNIX_time structure in Windows

    I need to get the system time from a Windows machine in a certain format, namely the GMT_UNIX_time format which is the number of seconds elapsed from the midnight starting Jan 1st 1970. Does anyone know how to do that?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    time
    The encoding of the return value is unspecified, but it may be in seconds since ...
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    124
    I don't understand your reply, none of the first 10 links on that google search relate to a time function.

  4. #4
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,673
    He wants you to use the UNIX man pages. Try searching for "unix man time" instead.

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    124
    But, I need this to work under Windows, so how would a UNIX shell command help me?

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,440
    man pages are help files.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    124
    Right, I know what a man page is, I've used linux/unix/bsd before. What I need is a C++ function of some sort to get a time structure in Windows, so a unix man page doesn't help me.

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,440
    Look... we could go on this forever, but obviously you are not making one ounce of an effort.

    google "man unix time". You will get a list of links that will help you with the time function.

    Then, when you actually click the links on google you will know why people are sending you there. It's an help file!
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,673
    Unless there is something wrong with the structure that the time.h functions return, I really don't see your point. I'm confident that the man page will help you understand if you would just read it.

    time.h is standard so it is cross-platform. It's irrelevant what documentation you read as long as it is from a reliable source.

  10. #10
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by maxhavoc
    Right, I know what a man page is, I've used linux/unix/bsd before. What I need is a C++ function of some sort to get a time structure in Windows, so a unix man page doesn't help me.
    Then look up the time function in your compiler's documentation. Can you be more thick?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  11. #11
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,440
    He's being sent to the time command, citizen. Which is fine. However, obviously it didn't even cross his mind to just perhaps type on google "man page time c++" or "c++ time help" or "how to use time c++" or... "duh!"
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing structure arrays to functions?
    By bem82 in forum C Programming
    Replies: 3
    Last Post: 10-30-2006, 05:17 AM
  2. structure problems in windows program.
    By Bajanine in forum Windows Programming
    Replies: 3
    Last Post: 04-19-2004, 06:18 PM
  3. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  4. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21