cHow to obtain the time accurate to the millisecond

Updated on technology 2024-02-09
11 answers
  1. Anonymous users2024-02-05

    I suggest you take a look at the blog post above.

  2. Anonymous users2024-02-04

    There is no standard interface in C that can be accurate to the millisecond, and only the API related to the operating system can be called.

  3. Anonymous users2024-02-03

    datetime(3 6) or timestamp(3 6).

    Just save it directly, mainly for the settings of database fields.

  4. Anonymous users2024-02-02

    "yyyy-mm-dd ");

    If the database requires the format to be 2017-07-31, and milliseconds are points, you need to use the example above!

  5. Anonymous users2024-02-01

    clock_t t1,t1;

    t1=clock();

    t2=clock();

    t2-t1) is seconds, but this is a decimal and can be obtained in milliseconds.

  6. Anonymous users2024-01-31

    First of all, I want to make it clear, this is what I know, and I will be OK if I baidu it often.

    #include

    #include

    void main ()

    include -- required time function header file.

    time t -- time type ( definition).

    structtm -- the temporal structure, defined as follows:

    int tm_sec;

    int tm_min;

    int tm_hour;

    int tm_mday;

    int tm_mon;

    int tm_year;

    int tm_wday;

    int tm_yday;

    int tm_isdst;

    time ( rawtime );The acquisition time, measured in seconds, is counted from January 1, 1970 onwards, and is stored in rawtime

    localtime ( rawtime );Convert to local time, TM time structure.

    asctime() to the standard ASCII time format:

    Day, month, day, hour: minute: second, year.

    The format you want can be output like this:

    printf ( 4d-%02d-%02d %02d:%02d:%02d",1900+timeinfo->tm_year, 1+timeinfo->tm_mon,timeinfo->tm_mday,timeinfo->tm_hour,timeinfo->tm_min,timeinfo->tm_sec);

    It is to print tm directly, tm year is calculated from 1900, so you have to add 1900, and monthtm mon, calculated from 0, so you have to add 1

    You can see the rest at a glance.

  7. Anonymous users2024-01-30

    clock_t t1,t1;

    t1=clock();

    t2=clock();

    t2-t1) is seconds, but this is a decimal and can be obtained in milliseconds.

  8. Anonymous users2024-01-29

    You try the following program:

    #include

    #include

    #include

    int main()

    I'm running under vc++ and I can get the timing in milliseconds.

  9. Anonymous users2024-01-28

    The main thing to write is how to get the millisecond value of time:

    #include

    #include

    #include

    #include

    int main( void )

  10. Anonymous users2024-01-27

    time(time t*), please refer to msdn for the required header file

  11. Anonymous users2024-01-26

    It doesn't make much sense to monitor time with the program itself, because the program runs in a system with irregular system resources.

    CPU, memory, scheduling is invisible to us, every program running in the system CPU, memory occupation is jitter, may be in a certain period of time when the system resources are tight, without scheduling to your program, it will be slow, this is difficult to say.

Related questions
9 answers2024-02-09

If you're using aspnet, he has a special function in. NET to get a computer name, IP address and current username is very simple, the following are a few methods I commonly use, if you have other good methods, you can reply and sort it out together: >>>More

7 answers2024-02-09

int sum=0;

for(int i = 0 ;i< -1;i++) assumes that the ID of the datalist is datalist1 >>>More

2 answers2024-02-09

Know, you can earn 42 experience points per day:

2 points for the first login, 20 points for voting, and 20 points for the first 10. >>>More

8 answers2024-02-09

Your anomaly was triggered, but it was eaten.

Because the using statement is actually try....Finally, your ** is equivalent to. >>>More

7 answers2024-02-09

Hello! We're sorry, but our smartphones don't have root access at the moment. There are two main reasons: >>>More