Linux C 函数参考(日期时间)

2023-05-16

 

1.1 概述

世界标准时间( Coordinated Universal Time UTC ),也就是大家所熟知的格林威治标准时间( Greenwich Mean Time GMT )。世界各地时间也世界标准时间为基准划分为不同的时区,例如,中国的北京时间与UTC 的时差为+8 ,也就是UTC+8 。美国是UTC-5
 
Calendar Time :日历时间,是用从一个标准时间点到此时的时间经过的秒数来表示的时间。无论哪一个时区,在同一时刻对同一个标准时间点来说,日历时间都是一样的。日历时间返回自1970-1-1:00:00:00 以来所经过的秒数累计值。
 
 
跟日期时间相关的shell命令
 
$ date                     // 显示当前日期
$ time                    // 显示程序运行的时间
$ hwclock              // 显示与设定硬件时钟
$ clock                   // 显示与设定硬件时钟,是hwclock 的链接文件
$ cal                       // 显示日历
 
 
1 date 显示或设置当前日期时间
$ date              显示当前日期时间 -- 中国北京时间 CST China Standard Time UTC+8:00
2008 05 01 星期四 04:28:27 CST
$ date –u         显示当前日期时间 -- 世界标准时间 UTC
2008 04 30 星期三 20:29:23 UTC
以上两个时间相比有8 个小时的时差
$ date –R         显示当前日期时间 – RFC 格式
Thu, 01 May 2008 04:30:25 +0800
$ date -s 20080501        设置日期
$ date -s 20:40:30          设置时间
 
 
2 time 显示程序运行时消耗的实际时间,用户CPU 时间和系统CPU 时间。
$ time a.out                  可执行程序a.out
real     0m10.081s              程序开始运行到结束的时间
user     0m0.000s        用户CPU 时间,
sys      0m0.004s        系统CPU 时间
 
用户CPU 时间等于times 函数返回的struct tms 中的tms_utime tms_cutime 和。
系统CPU 时间等于times 函数返回的struct tms 中的tms_stime tms_cstime 和。
 
 
3 hwclock        显示与设定硬件时钟
Linux 中有硬件时钟与系统时钟等两种时钟。硬件时钟是指主机板上的时钟设备,也就是通常可在BIOS 画面设定的时钟。系统时钟则是指 kernel 中的时钟。当Linux 启动时系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。所有Linux 相关指令与函数都是读取系统时钟的设定。
 
# hwclock –show          显示硬件时钟的时间与日期
# hwclock –hctosys             将硬件时钟调整为与目前的系统时钟一致
# hwclock –systohc             将硬件时钟调整为与目前的系统时钟一致
# hwclock --set --date="20080430 21:30:30"              设定硬件时钟
# hwclock                     hwclock –show
 
Clock 命名是hwclock 的链接文件
$ ls -al /sbin/clock
lrwxrwxrwx 1 root root 7 03-08 23:59 /sbin/clock -> hwclock
 
 
4 )显示日历
$ cal                             显示本年本月的日历
$ cal month year    显示指定年月的日历: cal 4 2008
 
 

1.2 跟日期时间有关的数据结构

1.2.1 clock_t 结构

程序开始运行到此时所经过的CPU 时钟计时单元数用clock 数据类型表示。
 
typedef long clock_t;
#define CLOCKS_PER_SEC ((clock_t)1000)      // 每个时钟单元是1 毫秒
 

1.2.2 time_t 结构

日历时间( Calendar Time )是通过time_t 数据类型来表示的,用time_t 表示的时间(日历时间)是从一个时间点(1970 1 1 0 0 0 )到此时的秒数。
 
typedef long time_t;                     // 时间值
 

1.2.3 tm结构

通过tm 结构来获得日期和时间
 
struct tm {
        int tm_sec;           /* 取值区间为[0,59] */
        int tm_min;           /* - 取值区间为[0,59] */
        int tm_hour;          /* - 取值区间为[0,23] */
        int tm_mday;        /* 一个月中的日期 - 取值区间为[1,31] */
        int tm_mon;          /* 月份(从一月开始,0 代表一月) - 取值区间为[0,11] */
        int tm_year;          /* 年份,其值等于实际年份减去1900 */
        int tm_wday;        /* 星期取值区间为[0,6] ,其中0 代表星期天,1 代表星期一 */
        int tm_yday;         /* 从每年1 1 日开始的天数取值区间[0,365] ,其中0 代表1 1 */
        int tm_isdst;   /* 夏令时标识符,夏令时tm_isdst 为正;不实行夏令时tm_isdst 0 */
};
 
 

1.2.4 tms结构

保存着一个进程及其子进程使用的CPU 时间
struct tms{
       clock_t tms_utime;
       clock_t tms_stime;
       clock_t tms_cutime;
       clock_t tms_cstime;
}
 

1.2.5 Utimbuf结构

struct utimbuf{
       time_t     actime;           // 存取时间
       time_t     modtime;        // 修改时间
}
 
文件的时间
st_atime          文件数据的最后存取时间
st_mtime         文件数据的最后修改时间
st_ctime          文件数据的创建时间


 

 

1.2.5 timeval结构

struct timeval
{
    time_t tv_sec;
    susecond_t tv_usec; //当前妙内的微妙数
};
 

 

 

 


1.2.6 timer_struct结构

struct timer_struct {

    unsigned long expires; //定时器被激活的时刻

    void (*fn)(void); //定时器激活后的处理函数 }

 

 

 

 

1.3 跟日期时间相关的函数

1.3.1 clock函数

 
#include <time.h>
clock_t clock(void);                   
返回从程序开始运行到程序中调用clock() 函数之间的CPU 时钟计时单元数
 
 
 
1:clock函数的例子
$ vi clock.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
 
int main(void)
{
    long    loop = 10000000L;
    double duration;
    clock_t start, end;
 
    printf("Time to do %ld empty loops is ", loop);
 
    start = clock();
    while(loop--)   ;
    end = clock();
 
    duration = (double)(end-start)/CLOCKS_PER_SEC;
    printf("%f seconds\n", duration);
 
    return(0);
}
编译、运行:
$ gcc clock.c -o clock
$ ./clock
Time to do 10000000 empty loops is 0.220000 seconds
 
 

1.3.2 time函数

日历时间 
#include <time.h>
time_t time(time_t *calptr)        
返回自1970-1-1:00:00:00 以来经过的秒数累计值
 
2:time函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now;
    time(&now);
    printf("now time is %d\n", now);
 
    return(0);
}
 
编译、运行:
$ gcc time.c -o time
$ ./time
now time is 1193688148
 
 

1.3.3 times函数

程序运行的时间
#include <sys/times.h>
clock_t times(struct tms *buf);   
返回自系统自举后经过的时钟滴答数
 
 
3:times函数的例子
#include <stdio.h>
#include <sys/times.h>
 
int main(void)
{
    int i;
    clock_t start, end;
    struct tms tms_start, tms_end;
 
    start = times(&tms_start);
    end = times(&tms_end);
 
    printf("start clock time : %d\n", start);
    printf("end   clock time : %d\n", end);
 
    return(0);
}
 
编译、运行:
$ gcc times.c -o times
$ ./times
Start clock time : 1720654909
End clock time : 1720654909
 

1.3.4 localtime函数

将日历时间变换成本地时间,考虑到本地时区和夏令时标志。
#include <time.h>
struct tm *localtime(const time_t * calptr);
 
4:localtime函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now;
    struct tm *tm_now;
 
    time(&now);
    tm_now = localtime(&now);
 
    printf("now datetime: %d-%d-%d %d:%d:%d\n", tm_now->tm_year, tm_now->tm_mon, tm_now->tm_mday, tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec);
 
    return(0);
}
 
编译、运行:
$ gcc localtime.c -o localtime
$ ./localtime
now datetime: 107-9-30 5:11:43
 

1.3.5 gmtime函数

将日历时间变换成国际标准时间的年月日分秒
#include <time.h>
struct tm *gmtime(const time_t *calptr);
 
5:gmtime函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now;
    struct tm *tm_now;
 
    time(&now);
    tm_now = gmtime(&now);
 
    printf("now datetime: %d-%d-%d %d:%d:%d\n", tm_now->tm_year, tm_now->tm_mon, tm_now->tm_mday, tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec);
 
    return(0);
}
 
编译、运行:
$ gcc gmtime.c -o gmtime
$ ./gmtime
now datetime: 107-9-29 21:15:26
 

1.3.6 mktime函数

以本地时间的年月日为参数,将其变换成time_t
#include <time.h>
time_t mktime(struct tm *tmptr);
 
 
6:mktime函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now, new_time;
    struct tm *tm_now;
 
    time(&now);
    printf("now time is %ld\n", now);
 
    tm_now = localtime(&now);
 
    new_time = mktime(tm_now);
    printf("new time is %ld\n", new_time);
 
    return(0);
}
 
编译、运行:
$ gcc mktime.c -o mktime
$ ./mktime
now time is 1193692806
new time is 1193692806
 

1.3.7 asctime函数

产生形式的26 字节字符串,参数指向年月日等字符串的指针。与date 命令输出形式类似
#include <time.h>
char *asctime(const struct tm *tmptr);
 
7:astime函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now;
    struct tm *tm_now;
    char *datetime;
 
    time(&now);
    tm_now = localtime(&now);
    datetime = asctime(tm_now);
 
    printf("now datetime: %s\n", datetime);
 
    return(0);
}
 
编译、运行:
$ gcc asctime.c -o asctime
$ ./asctime
now datetime: Tue Oct 30 05:22:21 2007
 

1.3.8 ctime函数

产生形式的26 字节字符串,参数指向日历时间的指针。
#include <time.h>
char *ctime(const time_t *calptr);
 
8:ctime函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now;
    char *datetime;
 
    time(&now);
    datetime = ctime(&now);
 
    printf("now datetime: %s\n", datetime);
 
    return(0);
}
 
编译、运行:
$ gcc ctime.c -o ctime
$ ./ctime
now datetime: Tue Oct 30 05:23:45 2007
 

1.3.9 strftime函数

格式化时间输出
#include <time.h>
size_t strftime(char *buf,size_t maxsize,const char *format,const struct tm *tmptr);
 
%a 星期几的简写 
%A 星期几的全称 
%b 月分的简写 
%B 月份的全称 
%c 标准的日期的时间串 
%C 年份的后两位数字 
%d 十进制表示的每月的第几天 
%D / /  
%e 在两字符域中,十进制表示的每月的第几天 
%F - -  
%g 年份的后两位数字,使用基于周的年 
%G 年分,使用基于周的年 
%h 简写的月份名 
%H 24 小时制的小时 
%I 12 小时制的小时 
%j 十进制表示的每年的第几天 
%m 十进制表示的月份 
%M 十时制表示的分钟数 
%n 新行符 
%p 本地的AM PM 的等价显示 
%r 12 小时的时间 
%R 显示小时和分钟:hh:mm 
%S 十进制的秒数 
%t 水平制表符 
%T 显示时分秒:hh:mm:ss 
%u 每周的第几天,星期一为第一天 (值从0 6 ,星期一为0  
%U 第年的第几周,把星期日做为第一天(值从0 53  
%V 每年的第几周,使用基于周的年 
%w 十进制表示的星期几(值从0 6 ,星期天为0  
%x 标准的日期串 
%X 标准的时间串 
%y 不带世纪的十进制年份(值从0 99  
%Y 带世纪部分的十进制年份 
%z %Z 时区名称,如果不能得到时区名称则返回空字符。 
%% 百分号 
 
 
9:strftime函数的例子
#include <stdio.h>
#include <time.h>
 
int main(void)
{
    time_t now;
    struct tm *tm_now;
    char    datetime[200];
 
    time(&now);
    tm_now = localtime(&now);
    strftime(datetime, 200, "%x %X %n%Y-%m-%d %H:%M:%S %nzone: %Z\n", tm_now);
 
    printf("now datetime : %s\n", datetime);
 
    return(0);
}
 
编译、运行:
$ gcc strftime.c -o strftime
]$ ./strftime
now datetime : 10/30/07 05:41:47
2007-10-30 05:41:47
zone: CST
 
 

1.3.10 utime函数

更改文件的存取和修改时间
#include <time.h>
int utime(const char pathname, const struct utimbuf *times)     
返回值:成功返回0 ,失败返回-1
times 为空指针,存取和修改时间设置为当前时间
 
 
10utime函数的例子
 
#include <stdio.h>
#include <time.h>
 
int main(int argc, char *argv[])
{
       if(argc < 2){
              fprintf(stderr, "Error: usging command file_path");
              exit(1);
       }
 
       utime(argv[1], NULL);
 
       return(0);
}
 
编译、运行:
$ touch file1
$ ls -al file1            // 先创建一个文件file1 ,查看一下他的创建时间
-rw-r--r-- 1 hongdy hongdy 3431 05-01 05:59 file1
$ gcc utime.c –o utime
$ ./utime file1        
$ ls -al file1
-rw-r--r-- 1 hongdy hongdy 3431 05-01 06:00 file1
 
 

1.3.11 gettimeofday函数

取得目前的时间

#include <time.h>
int gettimeofday ( struct& nbsptimeval * tv , struct timezone * tz )

 

函数说明  gettimeofday()会把目前的时间有tv所指的结构返回,当地时区的信息则放到tz所指的结构中。
timeval结构定义为:
struct timeval{
long tv_sec; /*秒*/
long tv_usec; /*微秒*/
};
timezone 结构定义为:
struct timezone{
int tz_minuteswest; /*和Greenwich 时间差了多少分钟*/
int tz_dsttime; /*日光节约时间的状态*/
};
上述两个结构都定义在/usr/include/sys/time.h。tz_dsttime 所代表的状态如下
DST_NONE /*不使用*/
DST_USA /*美国*/
DST_AUST /*澳洲*/
DST_WET /*西欧*/
DST_MET /*中欧*/
DST_EET /*东欧*/
DST_CAN /*加拿大*/
DST_GB /*大不列颠*/
DST_RUM /*罗马尼亚*/
DST_TUR /*土耳其*/
DST_AUSTALT /*澳洲(1986年以后)*/
 
返回值  成功则返回0,失败返回-1,错误代码存于errno。附加说明EFAULT指针tv和tz所指的内存空间超出存取权限。
times 为空指针,存取和修改时间设置为当前时间
 
 
10gettimeofday函数的例子
 
#include<sys/time.h>
#include<unistd.h>
main(){
struct timeval tv;
struct timezone tz;
gettimeofday (&tv , &tz);
printf(“tv_sec; %d\n”, tv,.tv_sec)
printf(“tv_usec; %d\n”,tv.tv_usec);
printf(“tz_minuteswest; %d\n”, tz.tz_minuteswest);
printf(“tz_dsttime, %d\n”,tz.tz_dsttime);
}
 
编译、运行:
tv_usec:136996
tz_minuteswest:-540
tz_dsttime:0
tv_sec: 974857339

 

 
 

1.3.12 settimeofday函数

设置目前时间

#include<sys/time.h>
#include<unistd.h>
 
int settimeofday ( const& nbspstruct timeval *tv,const struct timezone *tz);
 
函数说明  settimeofday()会把目前时间设成由tv所指的结构信息,当地时区信息则设成tz所指的结构。详细的说明请参考gettimeofday()。注意,只有root权限才能使用此函数修改时间。
 
返回值  成功则返回0,失败返回-1,错误代码存于errno。
 
错误代码  EPERM 并非由root权限调用settimeofday(),权限不够。
EINVAL 时区或某个数据是不正确的,无法正确设置时间。
times 为空指针,存取和修改时间设置为当前时间
 
 
12settimeofday函数的例子
 
/************************************************
设置操作系统时间
参数:*dt数据格式为"2006-4-20 20:30:30"
调用方法:
char *pt="2006-4-20 20:30:30";
SetSystemTime(pt);
**************************************************/
int SetSystemTime(char *dt)
{
struct rtc_time tm;
struct tm _tm;
struct timeval tv;
time_t timep;
sscanf(dt, "%d-%d-%d %d:%d:%d", &tm.tm_year,
&tm.tm_mon, &tm.tm_mday,&tm.tm_hour,
&tm.tm_min, &tm.tm_sec);
_tm.tm_sec = tm.tm_sec;
_tm.tm_min = tm.tm_min;
_tm.tm_hour = tm.tm_hour;
_tm.tm_mday = tm.tm_mday;
_tm.tm_mon = tm.tm_mon - 1;
_tm.tm_year = tm.tm_year - 1900;

timep = mktime(&_tm);
tv.tv_sec = timep;
tv.tv_usec = 0;
if(settimeofday (&tv, (struct timezone *) 0) < 0)
{
printf("Set system datatime error!\n");
return -1;
}
return 0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Linux C 函数参考(日期时间) 的相关文章

  • AI电销机器人系统源码部署三:freeswitch安装Linux

    下载freeswitch安装包 xff08 freeswitch 1 10 2 release tar gz xff09 可以根据个人情况下载最新版本 https freeswitch org confluence display FREE
  • gitlab之webhook自动部署

    转自 xff1a https www jianshu com p 00bc0323e83f 动机 前段时间st0rm23在自己的服务器上搭好了自己的gitlab xff0c 现在我准备开搞自己的web项目了 但是如果每次写完都要用一些文件传
  • CCF CSP元素选择器

    CCF CSP元素选择器 结果 解析 利用bfs xff0c 这道题细节问题一方面是标签大小写不敏感 xff0c 另一方面是祖先的祖先仍然是该元素的祖先 span class token macro property span class
  • 【判断回文+约瑟夫问题】

    本实验用C语言实现 两个实验写在一个程序里 实验内容 xff1a 1 回文是指正读反读均相同的字符序列 xff0c 如 abba 和 abdba 均为回文 xff0c 但是 good 不是回文 试写一个算法判定给定的字符序列是否为回文 xf
  • C语言递归方法实现斐波那契数列

    本文介绍面试题经典试题之一 xff1a C语言用递归方法实现斐波那契数列 xff08 从第三个数起 xff0c 后一个数等于前面两个数之和 xff09 xff1a 1 1 2 3 5 8 13 21 34 include long int
  • char encode——ASCII

    char encode ASCII
  • 报错:ModuleNotFoundError: No module named ‘PIL‘,安装PIL的基本步骤

    ModuleNotFoundError No module named PIL 当出现这个问题时 xff0c 是因为没有安装PIL 安装PIL的基本步骤 xff1a 1 首先使用快捷键 Ctrl 43 R 运行打开任务栏 xff1b 2 在
  • ubuntu20.04+windows10_1909显卡直通(GPU Passthrough)

    休息的时候看到了Nvidia放开了个人显卡在虚拟机里使用的操作权限 xff0c 就花了点时间研究了下 xff0c 最终的目的是能在win虚拟机里流畅地打游戏 这里记录下踩过的坑 cpu支不支持虚拟化和你开没开虚拟化是俩玩意 网上的教程里都是
  • macOS Mojave 使用SMB局域网共享作为TimeMachine时间机器的备份盘报错Disk does not support Time Machine backups. (error 45)

    参考网上的教程 xff0c 使用 磁盘工具 创建一个 稀疏磁盘映像 在共享的文件夹中 xff0c 然后使用命令设置为TimeMachine的目标盘 sudo tmutil setdestination a Volumes SMBTimeMa
  • Debian apt update 提示 由于没有公钥,无法验证下列签名...

    sudo apt update 忽略 1 http mirrors aliyun com debian stretch InRelease 命中 2 http mirrors aliyun com debian security stret
  • Debian10:添加硬盘

    安装好Debian10系统后 xff0c 若服务器有多个硬盘 xff0c 则需要硬盘分区和格式化 xff0c 然后挂载到系统方能使用 当前服务器有两个硬盘 xff1a 硬盘0 xff1a 容量128G xff0c 用作系统盘 xff0c 已
  • Debian10: 首次配置

    Debian10系统安装完成后 xff0c 可以通过Windows客户端的XShell或同类工具远程登陆服务器进行操作 xff0c 这样会方便很多 此外 xff0c 还应该熟悉一下Linux一的vi工具和cat命令 xff0c cat命令用
  • Lz4压缩算法学习

    一 简介 Lz4压缩算法是由Yann Collet在2011年设计实现的 xff0c lz4属于lz77系列的压缩算法 lz77严格意义上来说不是一种算法 xff0c 而是一种编码理论 xff0c 它只定义了原理 xff0c 并没有定义如何
  • 03. 面向对象分析过程

    03 面向对象分析 1 面向对象 xff08 1 xff09 OOA Object oriented Analysis 面向对象分析 事物的分类 命名 描述 xff08 2 xff09 OOD Object oriented Design
  • 修改python pip安装第三方包的安装路径

    由于某种原因将pip的安装路径设置到了C盘用户目录下面 xff0c 导致每次清理垃圾时就顺带把安装的第三方包给清理掉了 xff0c 因此需要更改pip第三方包的安装路径 首先找到python的安装路径 where python 在pytho
  • 树莓派3b终端命令行播放器omxplayer,通过HDMI屏幕播放视频

    omxplayer是一款可以使用命令行控制的播放器 xff0c 图像通过 HDMI显示到屏幕上 树莓派可以运行omxplayer xff0c 在终端使用命令行播放视频 1 安装omxplayer sudo apt get install o
  • stm32单片机OLED取字模软件使用 PCtoLCD2002

    PCtoLCD2002 xff0c 适用单色屏取字模制作字库 xff0c 进行位图转换 xff0c 还可自行描点 xff0c 使用非常简单方便 1 取字模 xff0c 制作字库 打开PCtoLCD2002 单片机OLED或者其他单色屏 xf
  • Linux 下编译并安装配置 Qt 全过程

    1 获得源代码 src 官网下载地址 xff1a ftp ftp qt nokia com qt source 2009 年 10 月 1 日发布的 qt x11 opensource src 4 5 3 tar gz xff0c 大小 1
  • CentOS8使用gmssl搭建demoCA及配置OCSP服务

    本文档以CentOS8 43 GmSSL2 5 4版本为例 1 GmSSL搭建CA 1 1 安装GmSSL 我们知道 xff0c Linux下默认只有openssl的发行版 xff0c 并没有默认安装GmSSL xff0c 所以需要手动下载
  • 二、Linux SSH远程连接Windows

    1 关闭防火墙 2 允许远程访问 3 安装SSH服务器并启动 4 打开Linux查看防火墙状态 xff0c 未关闭则用system stop firwall暂时关闭防火墙 5 测试网络连通性 xff0c 不通则检查网卡 xff0c 保证网络

随机推荐

  • Linux qt6安装

    首先qt目前正常安装的话 xff0c 需要先在官网注册一个账号 xff0c 邮箱激活下 xff0c 记住账号密码就好 xff0c 这个是目前qt安装必须的 目前安装的方式有两种 xff0c 推荐大家使用在线联网安装 xff08 官网已不提供
  • Shell系统学习之如何执行Shell程序

    系列文章目录 Shell系统学习之什么是Shell Shell系统学习之创建一个Shell程序 Shell系统学习之向Shell脚本传递参数 Shell系统学习之如何执行Shell程序 Shell系统学习之Shell变量和引用 Shell系
  • 个人Obsidian同步和分享方案:AList+rclone+PicHoro

    Obsidian同步方案 最近尝试了下Obsidian这款笔记工具 xff0c 整体体验还是不错的 xff0c 但obsidian的同步确实是个大问题 我的主要需求是windows编辑加安卓端的查看 xff0c 偶尔可能需要编辑一下 xff
  • MySQL之limit用法

    SELECT FROM table LIMIT offset rows rows OFFSET offset 意思就是说 xff1a 可以这样子 xff1a SELECT FROM table LIMIT offset rows 或者这样子
  • 安卓定时器每5分钟执行一次方法

    import android os Handler 定时任务实现 private Handler handler 61 new Handler Runnable runnable 61 new Runnable 64 Override pu
  • 文件操作汇总

    为方便复习 xff0c 汇总一下以前相关笔记的索引 linux操作总结汇总 xff1a 进程内存通信 C语言 详解C中的系统调用open close read write C中文件操作复习 最近有关linux文件操作的总结
  • Anaconda安装及基本使用

    1 linux安装 conda可以创建多种语言环境 xff0c 支持的语言有 xff0c 可以创建多种复杂环境 xff0c 如果只需要python环境 xff0c pycharm自带的应该可以满足需求 Python R Ruby Lua S
  • Ubuntu18.04安装过程中界面卡死,完美解决办法

    让我们开始吧 在网上搜了资料 xff0c 总结如下 xff1a 1 u盘启动过程中 xff0c 会出现选择界面 xff0c try ubuntu install ubuntu等 xff0c 此时点 e 键 xff0c 会出现一个黑框 xff
  • 打包成jar文件后运行出现Invalid or corrupt jarfile 解决

    Invalid or corrupt jarfile home WebService jar Failed to load Main Class manifest attribute from home WebService jar 打ja
  • TX2(ubuntu 18.04)更换清华镜像源

    注意 xff0c 该版本的TX2有两个特点 xff1a Arm架构和ubuntu18 04 一 备份 sudo cp etc apt sources list etc apt sources list bak 先备份原文件sources l
  • Ubuntu22.04+Nvidia RTX 3060 显卡驱动安装

    新装 Ubuntu22 04 LTS xff0c 电脑配的是Nvidia RTX 3060 xff0c 所以需要安装显卡驱动 xff0c 未安装前显卡显示如下 xff1a 1 设置阿里源 在软件和更新在第一栏Ubuntu 软件页面中 xff
  • 基于深度学习算法实现视频人脸自动打码

    前言 1 在当下的环境上 xff0c 短视频已是生活的常态 xff0c 但这是很容易就侵犯别人肖像权 xff0c 好多视频都会在后期给不相关的人打上码 xff0c 这里是基于yolov5的人脸检测实现人脸自动打码功能 2 开发环境是win1
  • 树莓派4B设置双网卡静态IP、网卡优先级、查看系统多少位

    1 设置静态IP 下面两种方法都试过 xff0c 可以永久保存 方法2更官方一些 但是 xff0c 方法 1 右上角可视化设置IP不知道为什么无法使用 xff0c 设置好后重启 xff0c 再ping局域网设备 xff0c 总是出现提示 x
  • 基于ZLG/BOOT的linux2.6内核移植(s3c2410)

    基于ZLG BOOT的linux2 6内核移植 s3c2410 ZLG BOOT是广州致远arm实验箱自带的bootloader 我用的这款实验箱自带的linux内核还是2 4版本的 有点儿老了 所 以想移植个2 6上去 由于bootlod
  • Linux如何挂载Windows的NTFS分区?

    使用的是RedHat Linux xff0c 其暂时还不能支持NTFS 分区的直接挂载 xff0c 目前有两种方法可以解决这个问题 一是重新编写Linux 内核 xff0c 二是安装一个功能RPM补丁 本文讨论的是第二种方法 第一步 xff
  • 基于Video4Linux 的USB摄像头图像采集实现

    J W Hu 的 基于Video4Linux 的USB摄像头图像采集实现 Linux本身自带了采用ov511芯片的摄像头 xff0c 而市场上应用最广泛的是采用中 芯微公司生产的zc301芯片的摄像头 xff0c 下面我将针对这两大系列的摄
  • SpringBoot + MyBatisPlus 异常 The SQL execution time is too large, please optimize !

    网上看了很多例子 xff0c 五花八门 xff0c 我是这样解决的 xff0c 配置application yml 把红色那行代码注释掉 xff0c 成功 xff0c 没有出现问题 spring datasource 数据源的基本配置 us
  • ARM-LINUX调试中segmentation fault 的解决参考

    可恶的segmentation fault问题解决探索 xff08 转载 xff09 http oss lzu edu cn blog article php tid 700 html 背景 最近一段时间在linux下用C做一些学习和开发
  • VC 多线程编程

    一 问题的提出 编写一个耗时的单线程程序 xff1a 新建一个基于对话框的应用程序SingleThread xff0c 在主对话框IDD SINGLETHREAD DIALOG添加一个按钮 xff0c ID为IDC SLEEP SIX SE
  • Linux C 函数参考(日期时间)

    1 1 概述 世界标准时间 xff08 Coordinated Universal Time xff0c UTC xff09 xff0c 也就是大家所熟知的格林威治标准时间 xff08 Greenwich Mean Time xff0c G