显示标签为“linux”的博文。显示所有博文
显示标签为“linux”的博文。显示所有博文

2011年1月6日星期四

Time in Linux programming

Kernel measures the passage of the time in three different ways:

  1. Wall time ---> measuring absolute time
  2. Process time
  3. Monotonic time ---> calculating relative time

    Unix systems represent absolute time as the number of elapsed seconds since the epoch, which is defined as 00:00:00 UTC on the morning of 1 January 1970.
    SO, even absolute time is, at a low level, relative time.

    The following table shows some useful functions for uing time:
Name second Microsecond Nanosecond
Getting the current time of day time() gettimeofday() clock_gettime()
Setting the current time of day stime() settimeofday() clock_settime()
Sleeping sleep() usleep() nanosleep()

Now Microsoft, ipod nano are in my mind, are these names from here? So interesting.

With a 32-bit long type, time_t will let us have the Y2K mess all over again --- in 2038!

and "Come 22:14:07 on Monday, 18 January 2038, most systems and software will be 64-bit." said Robert Love. Will these happen, let's go and see.

POSIX Clocks have four of the linux standard time source:

  • CLOCK_MONOTONIC
  • CLOCK_PROCESS_CPUTIME_ID
  • CLOCK_REALTIME
  • CLOCK_THREAD_CPUTIME_ID

Tuning the system clock

example by a Makefile

make looks at the file modification timestamps of the source file versus the object file. If the source file is newer than the object file, make rebuilds the source file into an updated object file. If the source file is not newer than the object, however, no action is taken

2010年12月29日星期三

basic git command

git is the fast version control system


Now I am studying how to use git

  • Here are the commands for common using:

  1. Use git clone to check out sources. i.e. Download pulseaudio sources:

    
    
    
  2. Use git status to show your working tree status

    
    
  3. Use git pull to update the codes to the newest version

    
    
  4. Add or edit your file

  5. Commit your new file

    
    
  6. Push your change to remote repository

    
    

  • Here is a sample to generate a patch