The R Project SVN R

Rev

Rev 32861 | Rev 35265 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32861 Rev 34315
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 2000-2004  The R Development Core Team.
3
 *  Copyright (C) 2000-2005  The R Development Core Team.
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 455... Line 455...
455
    checkArity(op, args);
455
    checkArity(op, args);
456
    PROTECT(x = coerceVector(CAR(args), REALSXP));
456
    PROTECT(x = coerceVector(CAR(args), REALSXP));
457
    if(!isString((stz = CADR(args))) || LENGTH(stz) != 1)
457
    if(!isString((stz = CADR(args))) || LENGTH(stz) != 1)
458
	error(_("invalid 'tz' value"));
458
	error(_("invalid 'tz' value"));
459
    tz = CHAR(STRING_ELT(stz, 0));
459
    tz = CHAR(STRING_ELT(stz, 0));
-
 
460
    if(strlen(tz) == 0) {
-
 
461
	/* do a direct look up here as this does not otherwise
-
 
462
	   work on Windows */
-
 
463
	char *p = getenv("TZ");
-
 
464
	if(p) tz = p;
-
 
465
    }
460
    if(strcmp(tz, "GMT") == 0  || strcmp(tz, "UTC") == 0) isgmt = 1;
466
    if(strcmp(tz, "GMT") == 0  || strcmp(tz, "UTC") == 0) isgmt = 1;
461
    if(!isgmt && strlen(tz) > 0) settz = set_tz(tz, oldtz);
467
    if(!isgmt && strlen(tz) > 0) settz = set_tz(tz, oldtz);
462
 
468
 
463
    n = LENGTH(x);
469
    n = LENGTH(x);
464
    PROTECT(ans = allocVector(VECSXP, 9));
470
    PROTECT(ans = allocVector(VECSXP, 9));
Line 516... Line 522...
516
	error(_("invalid 'x' argument"));
522
	error(_("invalid 'x' argument"));
517
    if(!isString((stz = CADR(args))) || LENGTH(stz) != 1)
523
    if(!isString((stz = CADR(args))) || LENGTH(stz) != 1)
518
	error(_("invalid 'tz' value"));
524
	error(_("invalid 'tz' value"));
519
 
525
 
520
    tz = CHAR(STRING_ELT(stz, 0));
526
    tz = CHAR(STRING_ELT(stz, 0));
-
 
527
    if(strlen(tz) == 0) {
-
 
528
	/* do a direct look up here as this does not otherwise
-
 
529
	   work on Windows */
-
 
530
	char *p = getenv("TZ");
-
 
531
	if(p) tz = p;
-
 
532
    }
521
    if(strcmp(tz, "GMT") == 0  || strcmp(tz, "UTC") == 0) isgmt = 1;
533
    if(strcmp(tz, "GMT") == 0  || strcmp(tz, "UTC") == 0) isgmt = 1;
522
    if(!isgmt && strlen(tz) > 0) settz = set_tz(tz, oldtz);
534
    if(!isgmt && strlen(tz) > 0) settz = set_tz(tz, oldtz);
523
 
535
 
524
    for(i = 0; i < 6; i++)
536
    for(i = 0; i < 6; i++)
525
	if((nlen[i] = LENGTH(VECTOR_ELT(x, i))) > n) n = nlen[i];
537
	if((nlen[i] = LENGTH(VECTOR_ELT(x, i))) > n) n = nlen[i];