#include #include #include #include int main(int argc, char const *argv[]) { time_t at = time(NULL); char buf[32] = ""; sprintf(buf, "%d 运行中", getpid()); write(1, buf, sizeof(buf)); sleep(2); time_t bt = time(NULL); printf("\n%d 结束\n", getpid()); printf("运行时间:%ld 秒\n", bt - at); return 0; }