Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 309895 Details for
Bug 452185
gettimeofday() jumping into the future
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Attached is a c program which reproduces the issue (tooj.c)
tooj.c (text/plain), 2.40 KB, created by
Need Real Name
on 2008-06-20 04:04:40 UTC
(
hide
)
Description:
Attached is a c program which reproduces the issue (tooj.c)
Filename:
MIME Type:
Creator:
Need Real Name
Created:
2008-06-20 04:04:40 UTC
Size:
2.40 KB
patch
obsolete
>#include <unistd.h> >#include <sys/time.h> > >#define USAGE_STR "tooj <freq (seconds)> <batch> [d]\n" > >int main(int argc, > char * argv[]); > >/* ===================================================================== */ > >int main(int argc, > char * argv[]) > { > struct timeval sCurTime; > struct timeval sLastTime; > int iIndex; > int iInterval; > int iBatch = 0; > int iTrace = 0; > int iTimes = 0; > > /* ---------------------------------------------------------------- */ > > if (argc != 3 && argc != 4) > { > printf(USAGE_STR); > return 0; > } > > iInterval = atoi(argv[1]); > > if (iInterval <= 0) > { > printf(USAGE_STR); > return 0; > } > > iBatch = atoi(argv[2]); > > if (iBatch <= 0) > { > printf(USAGE_STR); > return 0; > } > > if (argc == 4) > { > if (argv[3][0] == 'd') > { > iTrace = 1; > } > else > { > printf(USAGE_STR); > return 0; > } > } > > /* ---------------------------------------------------------------- */ > > if ((gettimeofday(&sLastTime, (struct timezone *)NULL)) == -1) > { > perror("gettimeofday error"); > return -1; > } > > /* ---------------------------------------------------------------- */ > > while(1) > { > for(iIndex = 0; iIndex < iBatch; iIndex++) > { > if ((gettimeofday(&sCurTime, (struct timezone *)NULL)) == -1) > { > perror("gettimeofday error"); > return -1; > } > > if (timercmp(&sCurTime, &sLastTime, <)) > { > printf("time out of joint!" > " %d tries, " > "current time %ld.%ld, " > "last time %ld.%ld\n", > > iTimes, > > sCurTime.tv_sec, > sCurTime.tv_usec, > > sLastTime.tv_sec, > sLastTime.tv_usec); > > return -2; > } > else > { > if (iTrace) > { > printf("%d tries, " > "current time %ld.%ld, " > "last time %ld.%ld\n", > > iTimes, > > sCurTime.tv_sec, > sCurTime.tv_usec, > > sLastTime.tv_sec, > sLastTime.tv_usec); > } > } > > sLastTime = sCurTime; > } > > if (iTrace) > { > printf("\n"); > } > > if (sleep(iInterval) != 0) > { > perror("sleep error"); > return -3; > } > > iTimes++; > } > > /* ---------------------------------------------------------------- */ > > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 452185
: 309895