Summarize and organize the common library functions of C language in Linux----time and date math and algorithm

Source: Internet
Author: User
Tags mathematical functions set time square root time and date

In the absence of an IDE, it is necessary to remember the function names, parameters, basic usage, and considerations of some commonly used library functions.

Referring to the Linux_c_hs.chm directory, I have roughly divided the usual functions into several categories:

    • 1. Memory and string control and operation
    • 2. String conversions
    • 3. Character test
    • 4. File operation
    • 5. Time and date
    • 6. Common mathematical functions
    • 7. File Content operation
    • 8. File Permissions Control
    • 9. Process Operations
    • 10. Threading Operations
    • One. Socket operation
    • 12. Signal Processing
    • 13. Data structures and algorithms

    • Time function collation
/*Time Function Collation * * Function name usage remarks **1.char *asctime (const struct          TM *tm);            Obtain the TM first, and then the string format indicates that the thread is unsafe, there is a secure version plus _r**2.char *ctime (const time_t *TIMEP); Parameter up**3 can be obtained directly from time ().     struct TM *gmtime (const time_t *TIMEP);   Convert between formats thread unsafe **4.STRUCT TM *localtime (const time_t *TIMEP);                NT up**5.time_t mktime (struct TM *tm);                   NT nt**6.time_t Time (time_t *tloc); NT is first called **7.  int gettimeofday (struct timeval *tv, struct timezone *tz); NT gets time **8.      int settimeofday (const struct Timeval *tv, const struct timezone *tz); NT set time **9.    size_t strftime (char *s, size_t max, const char *format, const struct TM *TM); NT time converted to a string that can be formatted as specified **/
    • Classification of common mathematical functions
/* Common Mathematical Functions collation * *           function name                                  usage                                Note **1. int abs (int j);                         To find the absolute value of an integer                              NT,GCC compilation requires-lm**2. Float Ceilf (float x);                   Minimum integer value of not less than parameter                      nt**3.double exp (double x);                    Calculates the X-square value of the base e                        nt**4. Double log (double x);                   Calculates an e-based X-pair value                        nt**5. Double sqrt (double x);                  Calculates the square root value                                nt**6.double pow (double x, double y);          Calculates the X-based y-square value                        nt**7. Double log10 (double x);                 Calculates an X-pair value of 10 at the bottom of the                       NT* /

    • Data structure and algorithm classification
/* data structure and algorithm collation * *           function name                                  usage                                remarks **1.char *crypt (const char *key, const char *salt);  Encrypted data                            thread is unsafe, there is a secure version _R,GCC compilation required to add-lcrypt**2.void qsort (void *base, size_t nmemb, size_t size,       int (*compar) (const void *, const void *));  The comparison function can be based on integers or char to do similar strcmp functions to      support various data types of fast-row **3.int rand_r (unsigned int *seedp);             Generate random number seeds                          in general, the parameters can be filled in time (NULL), the seed is different random values **4.int rand (void);                              The random value in [0, Rand_max]             cannot be re-entered, there is a secure version _r** /

The above is a summary of time-date functions, mathematical functions, algorithm functions and so on.

The next step is to summarize the sockets, threads, processes, and signals.

Summarize and organize the common library functions of C language in Linux----time and date math and algorithm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.