Solved

gettimeofday in linux to windows platform

Posted on 2004-08-06
9
881 Views
Last Modified: 2008-02-07

Hi... I completed by project in Linux platform and now I what to convert it to windows platform
but wjen I start compiling in C++ compiler( both borland and visual c++ ) the compiler can't recognized gettimeofday which return type (timeval ) which can be second or milsecond???
so what can I do ???
If I plan to change the source code will impact many class....
0
Comment
Question by:albusaidi
9 Comments
 
LVL 11

Accepted Solution

by:
avizit earned 25 total points
ID: 11741969
one way would be to install cygwin  ( http://cygwin.com/ )

0
 

Author Comment

by:albusaidi
ID: 11742074
did You try it before .. I mean even all function used in linex like gettimeof day will be in windows after I dowload this tools.
Thank You
0
 
LVL 23

Assisted Solution

by:brettmjohnson
brettmjohnson earned 25 total points
ID: 11743164
How is gettimeofday() used?  If it is used as an interval timer, on Windows
you can call GetTickCount() instead.

0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 3

Expert Comment

by:teratoma
ID: 11745789
The portable solution would be to use the functions in time.h.  Cygwin should work if you just want to move a simple UNIX program to Windows, since it works with a lot of complex utilities that need to know the time of day.  Once you get Cygwin working it should feel familiar to a linux user.
0
 

Expert Comment

by:ole111
ID: 11756247
0
 
LVL 3

Expert Comment

by:teratoma
ID: 12094599
I posted a more complete recommendation so I should get more points :)  Requiring a Windows user to install Cygwin in order to use your software is a pretty bad answer, so I recommended using time.h which is standard.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question