search for: tm_year

Displaying 20 results from an estimated 39 matches for "tm_year".

2012 Feb 20
10
[PATCH] hvm: Correct RTC time offset update error due to tm->tm_year
Hi In rtc_set_time, mktime is called to calculate seconds since 1970/01/01, input parameters of mktime are required to be in normal date format. Such as: year=1980, mon=12, day=31, hour=23, min=59, sec=59. However, the current input parameter of mktime is tm->tm_year, and it is the number of years since 1900. (For example, if current time is 2012/12/31, and tm->tm_year is 112). This is not suitable for requirement of mktime. So I think tm->tm_year should be changed to tm->tm_year+1900 when calling mktime. Please check the patch attached. Thanks, A...
2009 Jul 21
1
Problem with INTERNALDATE when the year in localtime and GMT different
...the year in localtime and GMT different. /* max offset of 24 hours */ if (ltm.tm_yday < gtm.tm_yday) offset = -24 * 60; else if (ltm.tm_yday > gtm.tm_yday) offset = 24 * 60; else offset = 0; I think this code should be modified as followings. /* max offset of 24 hours */ if ((ltm.tm_year == gtm.tm_year && ltm.tm_yday < gtm.tm_yday) || (ltm.tm_year < gtm.tm_year)) offset = -24 * 60; else if ((ltm.tm_year == gtm.tm_year && ltm.tm_yday > gtm.tm_yday) || (ltm.tm_year > gtm.tm_year)) offset = 24 * 60; else offset = 0; On 1 Jan. 2009, I found an error...
2018 Aug 22
4
[PATCH] generator: Do not claim copyright for future years
...ngs.ml index fa7b1668a..b480d036e 100644 --- a/generator/docstrings.ml +++ b/generator/docstrings.ml @@ -68,9 +68,7 @@ let version_added = function Some (sprintf "%d.%d.%d" major minor release) | _ -> None -let copyright_years = - let this_year = 1900 + (localtime (time ())).tm_year in - if this_year > 2009 then sprintf "2009-%04d" this_year else "2009" +let copyright_years = "2009-2018" (* Generate a header block in a number of standard styles. *) type comment_style = -- 2.16.4
2007 Mar 21
1
bug and patch: strptime first-of-month error in (possibly unsupported use of) "%j" format (PR#9577)
...6,7 +796,7 @@ if(tm->tm_yday != NA_INTEGER) { /* since we have yday, let that take precedence over mon/mday */ int yday = tm->tm_yday, mon = 0; - while(yday > (tmp = days_in_month[mon] + + while(yday >= (tmp = days_in_month[mon] + ((mon==1 && isleap(1900+tm->tm_year))? 1 : 0))) { yday -= tmp; mon++;
2002 Apr 18
1
strptime mysteriously adds a day - 0S-specific: Linux and (PR#1467)
...format="%d %b")# ok > [1] "2002-02-28" > > strptime("19 March",format="%d %B")# wrong > [1] "2002-03-20" The issue is that an unspecified year is assumed *by the IS* to be 1900, a leap year. I'm not sure why glibc does this when the tm_year field is not being set, but it confidently says this is day 101 of the year, and that's the result you get. The only portable workaround is to give the year: there is (at least in R-devel) a warning in the help file about this. -- Brian D. Ripley, ripley@stats.ox.ac.uk Profe...
2017 Mar 21
0
[PATCH] p2v: Calculate offset of the Real Time Clock from UTC.
...rn; + } + + if (ioctl (fd, RTC_RD_TIME, &rtm) == -1) { + perror ("ioctl: RTC_RD_TIME"); + close (fd); + return; + } + + close (fd); + +#ifdef DEBUG_STDERR + fprintf (stderr, "%s: RTC: %04d-%02d-%02d %02d:%02d:%02d\n", + getprogname (), + rtm.tm_year + 1900, rtm.tm_mon + 1, rtm.tm_mday, + rtm.tm_hour, rtm.tm_min, rtm.tm_sec); +#endif + + /* Convert this to seconds since the epoch. */ + tm.tm_sec = rtm.tm_sec; + tm.tm_min = rtm.tm_min; + tm.tm_hour = rtm.tm_hour; + tm.tm_mday = rtm.tm_mday; + tm.tm_mon = rtm.tm_mon; + tm.tm_year...
2009 Feb 27
0
POSIXlt, POSIXct, strptime, GMT and 1969-12-31 23:59:59
...ndows is what is causing the failure elsewhere. As far as I can see, the code that is causing this is do_asPOSIXct in datetime.c: 695 if(!R_FINITE(secs) || tm.tm_min == NA_INTEGER || 696 tm.tm_hour == NA_INTEGER || tm.tm_mday == NA_INTEGER || 697 tm.tm_mon == NA_INTEGER || tm.tm_year == NA_INTEGER) 698 REAL(ans)[i] = NA_REAL; 699 else { 700 errno = 0; 701 tmp = mktime0(&tm, 1 - isgmt); 702 #ifdef MKTIME_SETS_ERRNO 703 REAL(ans)[i] = errno ? NA_REAL : tmp + (secs - fsecs); 704 #else 705 REAL(ans)[i] = (tmp == (double)(-1))...
2017 Mar 21
2
[PATCH] p2v: Calculate offset of the Real Time Clock from UTC.
Unlike the <cpu> node (see the other thread on the libguestfs ML), reading the Real Time Clock doesn't require libvirt and does work :-) For reference, read: https://libvirt.org/formatdomain.html#elementsTime https://en.wikipedia.org/wiki/Time_zone To test this you can run virt-p2v under qemu with a RTC offset: make -C p2v \ run-virt-p2v-in-a-vm \
2016 Mar 18
0
Fwd: libguestfs patch
...-- libguestfs-1.26.10.orig/generator/docstrings.ml +++ libguestfs-1.26.10/generator/docstrings.ml @@ -51,9 +51,7 @@ fact that they are deprecated indicates with correct use of these functions." prefix alt in Some txt -let copyright_years = - let this_year = 1900 + (localtime (time ())).tm_year in - if this_year > 2009 then sprintf "2009-%04d" this_year else "2009" +let copyright_years = "2009-2016" (* Generate a header block in a number of standard styles. *) type comment_style = ----- End forwarded message ----- I don't think I'd accept thi...
2018 Aug 22
0
Re: [PATCH] generator: Do not claim copyright for future years
...44 > --- a/generator/docstrings.ml > +++ b/generator/docstrings.ml > @@ -68,9 +68,7 @@ let version_added = function > Some (sprintf "%d.%d.%d" major minor release) > | _ -> None > > -let copyright_years = > - let this_year = 1900 + (localtime (time ())).tm_year in > - if this_year > 2009 then sprintf "2009-%04d" this_year else "2009" > +let copyright_years = "2009-2018" > > (* Generate a header block in a number of standard styles. *) > type comment_style = > -- > 2.16.4 > > __________________...
2002 Mar 08
1
1st January isn't (PR#1370)
In today's pre1.5.0 > ISOdate(2002,1,1) [1] "2002-03-01 04:00:00 PST" > ISOdate(2002,1,1)==ISOdate(2002,3,1) [1] TRUE It doesn't seem to happen for days other than 1/1 -thomas > version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status Under development (unstable) major 1 minor 5.0 year 2002 month
2002 Apr 18
0
strptime mysteriously adds a day - 0S-specific: Linux and (PR#1468)
...> > The issue is that an unspecified year is assumed *by the IS* to be 1900, a > leap year. Sorry, 1900 is not a leap year. Maybe glibc doesn't know that? :-) However, 'cal 1900' (on Linux) gives a correct answer. Göran > I'm not sure why glibc does this when the tm_year field is not > being set, but it confidently says this is day 101 of the year, and that's > the result you get. > > The only portable workaround is to give the year: there is (at least in > R-devel) a warning in the help file about this. > > -- Göran Broström...
2019 Oct 03
2
[PATCH] Avoiding Dereferencing of NULL pointer
...size, u_int32_t ogenerator, BIGNUM * omodulus) { - struct tm *gtm; + struct tm *gtm = NULL; time_t time_now; int res; time(&time_now); gtm = gmtime(&time_now); + if (!gtm) + return (-1); res = fprintf(ofile, "%04d%02d%02d%02d%02d%02d %u %u %u %u %x ", gtm->tm_year + 1900, gtm->tm_mon + 1, gtm->tm_mday, -- 2.7.4
2011 Oct 13
0
1) A memory leak in drivers/rhino.c 2) Wunused-but-set-variable.patch
...7]; int tam, i, j=0; - time_t *tmt; - struct tm *now; const char *Model; - tmt = ( time_t * ) malloc( sizeof( time_t ) ); - time( tmt ); - now = localtime( tmt ); - dian = now->tm_mday; - mesn = now->tm_mon+1; - anon = now->tm_year+1900; - weekn = now->tm_wday; - /* trying detect rhino model */ while ( ( !detected ) && ( j < 10 ) ) { @@ -644,14 +618,6 @@ static void getupdateinfo(void) unsigned char temp[256]; int tam; - /* time update */ - time_t...
2004 Apr 10
0
patches for copying atimes
...= 0; static void failed (char const *what, char const *where) @@ -57,14 +59,30 @@ exit (1); } +static void storetime(char *dest, + time_t t) +{ + if (t) { + struct tm *mt = gmtime(&t); + sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d", + mt->tm_year + 1900, + mt->tm_mon + 1, + mt->tm_mday, + mt->tm_hour, + mt->tm_min, + mt->tm_sec); + } else { + strcpy(dest, " "); + } +} static void list_file (const char *fname) { STRUCT_STAT buf; char permbuf[PERMSTRING_SIZE]; - struct tm *mt; - c...
2004 Jan 11
1
strange behaviour when converting from char to POSIX (PR#6427)
On Sun, 11 Jan 2004, Dirk Eddelbuettel wrote: > On Fri, Jan 09, 2004 at 06:01:27PM +0100, christoph.schmutz@meteoschweiz.ch wrote: > > Full_Name: Christoph Schmutz, MeteoSchweiz, Switzerland > > Version: R1.7.1, R1.8.1 > > OS: windows2000, solaris sunOS 5.8 > > Submission from: (NULL) (141.249.133.6) > > > > > > > > I'm not sure if I
2015 May 28
4
[PATCH 1/4] generator: move api_version to a common version_added
...d = function + | { added = (0, 0, release) } -> Some (sprintf "0.%d" release) + | { added = ((0|1) as major, minor, release) } -> + Some (sprintf "%d.%d.%d" major minor release) + | _ -> None + let copyright_years = let this_year = 1900 + (localtime (time ())).tm_year in if this_year > 2009 then sprintf "2009-%04d" this_year else "2009" -- 2.1.0
2003 Apr 20
4
${EPOCH} and ${DATETIME} patch
...+ *ret = workspace; + } else if (!strcmp(var, "DATETIME")) { + thistime=time(NULL); + localtime_r(&thistime, &brokentime); + snprintf(workspace, workspacelen -1, "%02d%02d%04d-%02d:%02d:%02d", + brokentime.tm_mday, + brokentime.tm_mon+1, + brokentime.tm_year+1900, + brokentime.tm_hour, + brokentime.tm_min, + brokentime.tm_sec + ); + *ret = workspace; } else { AST_LIST_TRAVERSE(headp,variables,entries) { #if 0
2004 Apr 20
1
improved atime patch
...= 0; static void failed (char const *what, char const *where) @@ -57,14 +59,30 @@ exit (1); } +static void storetime(char *dest, + time_t t) +{ + if (t) { + struct tm *mt = gmtime(&t); + sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d", + mt->tm_year + 1900, + mt->tm_mon + 1, + mt->tm_mday, + mt->tm_hour, + mt->tm_min, + mt->tm_sec); + } else { + strcpy(dest, " "); + } +} static void list_file (const char *fname) { STRUCT_STAT buf; char permbuf[PERMSTRING_SIZE]; - struct tm *mt; - c...
2012 Mar 05
6
[PATCH 3/5] RTC: Add UIP(update in progress) check logic
...UL + #define domain_vrtc(x) (&(x)->arch.hvm_domain.pl_time.vrtc) #define vcpu_vrtc(x) (domain_vrtc((x)->domain)) #define vrtc_domain(x) (container_of((x), struct domain, \ @@ -239,6 +241,22 @@ static void rtc_copy_date(RTCState *s) s->hw.cmos_data[RTC_YEAR] = to_bcd(s, tm->tm_year % 100); } +static int update_in_progress(RTCState *s) +{ + uint64_t guest_usec; + struct domain *d = vrtc_domain(s); + + if (s->hw.cmos_data[RTC_REG_B] & RTC_SET) + return 0; + + guest_usec = get_localtime_us(d); + /* UIP bit will be set at last 244us of every second....