天嵌 ARM开发社区

 找回密码
 注册
查看: 1931|回复: 5

设置并保存系统实时时钟实验提问

[复制链接]
brianyfb 发表于 2011-10-17 21:52:28 | 显示全部楼层 |阅读模式
设置并保存系统实时时钟实验 为什么我rtc的时间改成和现实时间一样了,每次开机后在终端中用date命令查的时间和现实时间一样,但是开发板液晶上的时间为什么就没改过来呢?不是开机后能和rtc同步么?
TQ_guoxixiao 发表于 2011-10-18 09:01:50 | 显示全部楼层
开发板液晶,你是什么开发板?
运行的什么系统?
亚瑟王 发表于 2011-10-18 10:25:37 | 显示全部楼层
如果你只运行了date命令,没有运行hwclock -w保存你设置的时间的话,那么你的设置在关机后就无效了。
 楼主| brianyfb 发表于 2011-10-19 15:06:16 | 显示全部楼层
3# 亚瑟王
[root@EmbedSky /]# date
Wed Oct 19 14:44:53 UTC 2011
[root@EmbedSky /]# date
Wed Oct 19 14:46:03 UTC 2011
[root@EmbedSky /]# date -s 082812302007
date: invalid date '082812302007'
[root@EmbedSky /]# date --help
BusyBox v1.16.0 (2010-04-17 19:14:08 CST) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

Options:
        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion

Recognized TIME formats:
        hh:mm[:ss]
        [YYYY.]MM.DD-hh:mm[:ss]
        YYYY-MM-DD hh:mm[:ss]
        [[[[[YY]YY]MM]DD]hh]mm[.ss]

[root@EmbedSky /]# date -s 2007-08-28 12:30
BusyBox v1.16.0 (2010-04-17 19:14:08 CST) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

Options:
        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion

Recognized TIME formats:
        hh:mm[:ss]
        [YYYY.]MM.DD-hh:mm[:ss]
        YYYY-MM-DD hh:mm[:ss]
        [[[[[YY]YY]MM]DD]hh]mm[.ss]

[root@EmbedSky /]# date
Wed Oct 19 14:48:44 UTC 2011
[root@EmbedSky /]# date 12:30:01
Wed Oct 19 12:30:01 UTC 2011
[root@EmbedSky /]# date
Wed Oct 19 12:30:03 UTC 2011
[root@EmbedSky /]# date -s 2007-08-28
date: invalid date '2007-08-28'
[root@EmbedSky /]# date -s 2007-08-28 12:30:01
BusyBox v1.16.0 (2010-04-17 19:14:08 CST) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

Options:
        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion

Recognized TIME formats:
        hh:mm[:ss]
        [YYYY.]MM.DD-hh:mm[:ss]
        YYYY-MM-DD hh:mm[:ss]
        [[[[[YY]YY]MM]DD]hh]mm[.ss]
[root@EmbedSky /]# date
Wed Oct 19 12:36:13 UTC 2011

设置时间为2007-08-2812:30  我这个怎么办啊?TQ2440开发板,我刚学的
 楼主| brianyfb 发表于 2011-10-19 16:50:08 | 显示全部楼层
2# TQ_guoxixiao

应该叫触摸屏吧,TQ2440,linux实验,设置时间为2007-08-2812:30,使用命令“#date -s
   082812302007”命令 提示date: invalid date '082812302007'
亚瑟王 发表于 2011-10-19 18:18:00 | 显示全部楼层
date -s MMDDhhmm[[YY]YY][.ss]
比如设置为:Tue Sep 13 14:15:00 UTC 2011
使用命令:date -s 091314152011
要保存参数使用:hwclock -w
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-5-27 18:23 , Processed in 1.062500 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表