Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 2009 09:00:37 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r195888 - in stable/7/lib/libc: . stdtime
Message-ID:  <200907260900.n6Q90bpi065075@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sun Jul 26 09:00:37 2009
New Revision: 195888
URL: http://svn.freebsd.org/changeset/base/195888

Log:
  Implement %z for strptime.
  
  PR:		kern/63064
  Submitted by:	Stefan `Sec` Zehl <sec 42 org> (with some small changes)

Modified:
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/stdtime/strptime.c

Modified: stable/7/lib/libc/stdtime/strptime.c
==============================================================================
--- stable/7/lib/libc/stdtime/strptime.c	Sun Jul 26 08:47:00 2009	(r195887)
+++ stable/7/lib/libc/stdtime/strptime.c	Sun Jul 26 09:00:37 2009	(r195888)
@@ -514,6 +514,34 @@ label:
 			}
 			}
 			break;
+
+		case 'z':
+			{
+			int sign = 1;
+
+			if (*buf != '+') {
+				if (*buf == '-')
+					sign = -1;
+				else
+					return 0;
+			}
+
+			buf++;
+			i = 0;
+			for (len = 4; len > 0; len--) {
+				if (isdigit((int)*buf)) {
+					i *= 10;
+					i += *buf - '0';
+					buf++;
+				} else
+					return 0;
+			}
+
+			tm->tm_hour -= sign * (i / 100);
+			tm->tm_min  -= sign * (i % 100);
+			*GMTp = 1;
+			}
+			break;
 		}
 	}
 	return (char *)buf;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907260900.n6Q90bpi065075>