mailing list of musl libc
 help / color / mirror / code / Atom feed
* RTC_RD_TIME
@ 2017-08-29 21:28 Jorge Almeida
  2017-08-30  1:43 ` RTC_RD_TIME Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Jorge Almeida @ 2017-08-29 21:28 UTC (permalink / raw)
  To: musl

A function to read the hardware clock (the battery powered thingy in
the motherboard):

(man 4 rtc)

void read_hw(struct rtc_time* rtctime){
   int rtcfd=open("/dev/rtc0" , O_RDONLY);
   ioctl(rtcfd, RTC_RD_TIME, rtctime);
   close(rtcfd);
}

(error checking omitted)

The problem:
warning: overflow in implicit constant conversion [-Woverflow]

(an arrow pointing to RTC_RD_TIME)

The same program compiles without warnings with glibc and dietlibc.

Headers:

#define _DEFAULT_SOURCE
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <time.h>
#include <linux/unistd.h>
#include <math.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <linux/vt.h>
#include <linux/rtc.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>

TIA

Jorge Almeida


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-30 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 21:28 RTC_RD_TIME Jorge Almeida
2017-08-30  1:43 ` RTC_RD_TIME Rich Felker
2017-08-30  6:35   ` RTC_RD_TIME Jorge Almeida
2017-08-30 12:55   ` RTC_RD_TIME Alexander Monakov
2017-08-30 15:20     ` RTC_RD_TIME Jorge Almeida
2017-08-30 16:42       ` RTC_RD_TIME Alexander Monakov

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).