touch.c (37259) | touch.c (42307) |
---|---|
1/* 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 246 unchanged lines hidden (view full) --- 255 if ((t = localtime(&now)) == NULL) 256 err(1, "localtime"); 257 258 t->tm_mon = ATOI2(arg); /* MMDDhhmm[yy] */ 259 --t->tm_mon; /* Convert from 01-12 to 00-11 */ 260 t->tm_mday = ATOI2(arg); 261 t->tm_hour = ATOI2(arg); 262 t->tm_min = ATOI2(arg); | 1/* 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 246 unchanged lines hidden (view full) --- 255 if ((t = localtime(&now)) == NULL) 256 err(1, "localtime"); 257 258 t->tm_mon = ATOI2(arg); /* MMDDhhmm[yy] */ 259 --t->tm_mon; /* Convert from 01-12 to 00-11 */ 260 t->tm_mday = ATOI2(arg); 261 t->tm_hour = ATOI2(arg); 262 t->tm_min = ATOI2(arg); |
263 if (year) | 263 if (year) { |
264 t->tm_year = ATOI2(arg); | 264 t->tm_year = ATOI2(arg); |
265 if (t->tm_year < 38) /* support 2000-2038 not 1902-1969 */ 266 t->tm_year += 100; 267 } |
|
265 266 t->tm_isdst = -1; /* Figure out DST. */ 267 tvp[0].tv_sec = tvp[1].tv_sec = mktime(t); 268 if (tvp[0].tv_sec == -1) 269 errx(1, 270 "out of range or illegal time specification: MMDDhhmm[yy]"); 271 272 tvp[0].tv_usec = tvp[1].tv_usec = 0; --- 74 unchanged lines hidden --- | 268 269 t->tm_isdst = -1; /* Figure out DST. */ 270 tvp[0].tv_sec = tvp[1].tv_sec = mktime(t); 271 if (tvp[0].tv_sec == -1) 272 errx(1, 273 "out of range or illegal time specification: MMDDhhmm[yy]"); 274 275 tvp[0].tv_usec = tvp[1].tv_usec = 0; --- 74 unchanged lines hidden --- |