Username or Email
Password
Remember me
Sign in
Sign up
Add Paste
Add Collection
You are not allowed to edit this paste! A fork will be created instead.
C/C++
CSS
HTML
Markdown
PHP
Python
Text
ABAP
ActionScript
ADA
Apache Conf
AsciiDoc
Assembly x86
AutoHotKey
BatchFile
BBCode
C9Search
Clojure
Cobol
CoffeeScript
ColdFusion
C#
Curly
D
Dart
Diff
Dot
Erlang
EJS
Forth
FreeMarker
Glsl
Go
Groovy
HAML
Handlebars
Haskell
haXe
HTML (Ruby)
INI
Jack
Jade
Java
JavaScript
JSON
JSONiq
JSP
JSX
Julia
LaTeX
LESS
Liquid
Lisp
LiveScript
LogiQL
LSL
Lua
LuaPage
Lucene
Makefile
MATLAB
MEL
MySQL
MUSHCode
Nix
Objective-C
OCaml
Pascal
Perl
pgSQL
Powershell
Prolog
Properties
Protobuf
R
RDoc
RHTML
Ruby
Rust
SASS
SCAD
Scala
Scheme
SCSS
SH
SJS
Space
snippets
Soy Template
SQL
Stylus
SVG
Tcl
Tex
Textile
Toml
Twig
Typescript
VBScript
Velocity
Verilog
XML
XQuery
YAML
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
struct linux_rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; #define RTC_SET_TIME _IOW('p', 0x0a, struct linux_rtc_time) /* Set RTC time */ #define RTC_RD_TIME _IOR('p', 0x09, struct linux_rtc_time) /* Read RTC time */ int main() { int rtc; struct tm tm; time_t t; struct timeval tv = { 0, 0 }; struct timezone tz = { 0, 0 }; int utc = 1; if ( gettimeofday ( &tv, &tz )) printf( "gettimeofday() failed" ); t = tv.tv_sec; return 0; if (( rtc = open ( "/dev/rtc0", O_WRONLY )) < 0 ) { if (( rtc = open ( "/dev/misc/rtc0", O_WRONLY )) < 0 ) printf( "Could not access RTC" ); } tm = *( utc ? gmtime ( &t ) : localtime ( &t )); tm.tm_isdst = 0; if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 ) printf( "Could not set the RTC time" ); close ( rtc ); return 0; }
Private