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

  • SEARCH
  • Home
  • 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 7368085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:37:13+00:00 2026-05-29T03:37:13+00:00

Greeting !! The following code works fine….at least more than one second will execute

  • 0

Greeting !!

The following code works fine….at least more than one second will execute expx function
in function Getexp , I called Getexp every 0.01 second for 100 times,
actually expx function will be called just one time only , that is what I want !!

But , my user need to change to at least more than 0.5 second to call expx ,
since the following code works in tick1 , tick2 in integer type ,
I need advice to change not too many codes below and will satisfy user needs ….

What function will be best suitable foe my case ? time_t won’t work for me in 0.5 sec case!

double Getexp(double valuex)
{
    double wgt=0.9 ;
    static double value_t0=0.0 ;
    static double value_t1=0.0 ;
    double dret = 0.0 ;
    static time_t tick1=0 ,tick2=0 ;

    if(value_t0 < 0.0001)
    {
        tick1=time(NULL);
        tick2=tick1 ;
        value_t0 = valuex ;
        value_t1 = valuex ;
        dret = expx(value_t1,value_t0,wgt) ;
        value_t0 = dret ;
        return value_t0   ;
    }
    tick2=time(NULL);
    if(tick2 > tick1)
    {
        tick1 = tick2 ;
        value_t1 = valuex ;
        dret = expx(value_t1,value_t0,wgt) ;
        value_t0 = dret ;
        return value_t0 ;
    }else
    {
        return value_t0  ;
    }
}
  • 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-29T03:37:14+00:00Added an answer on May 29, 2026 at 3:37 am

    It is rather difficult to assess what is being asked. But I suspect you are complaining that “time()” just has accuracy to the nearest second, but you need sub-second accuracy.

    Some clock functions to explore instead of calling “time”.

    GetTickCount (Windows)

    GetSystemTime (Windows)

    gettimeofday

    clock_gettime

    In other words, consider converting your code to process time in terms of milliseconds and use one of the appropriate calls above to get the that time

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings. I'm having troubles with the following legacy code. It's fine in everything except
the following code #include <iostream> using namespace std; int main(){ char greeting[50] = goodmorning
Consider the following code: public class MyClass { public delegate string PrintHelloType(string greeting); public
Greetings, I have the following JS code: var reloadTimer = function (options) { var
Can the following be done in C#?: var greeting = Hello + function ()
With the following code shows a preview of the camera vertically and it's works..
The following link_to_function works: <%= link_to_function click, alert(Hallo world! %> However, with jquery, the
Greeting all, iptables -L gives the following output [root@ibmd ~]# iptables -L Chain INPUT
Can anyone explain to me what the following syntax mean? ViewData [greeting] = (hour
I have a problem passing a string argument using Perl. The following code #!/usr/bin/perl

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.