PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|site_perl|Date|Manip.pm =

page 10 of 76



    # absolute time zone     +0700 (GMT)
    my($hzone)='(?:[0-1][0-9]|2[0-3])';     # 00 - 23
    my($mzone)='(?:[0-5][0-9])';            # 00 - 59
    my($zone2)='(?:\s*([+-](?:'."$hzone$mzone|$hzone:$mzone|$hzone))".
                                            # +0700 +07:00 -07
      '(?:\s*\([^)]+\))?)';                 # (GMT)

    # A regular expression for the time EXCEPT for the hour part
    my($mnsec)="$hm$DD(?:$ms$DD$FS)?(?:\\s*$ampmexp)?";

    # A special regular expression for /YYYY:HH:MN:SS used by Apache
    my($apachetime)='(/\d{4}):' . "$DD$hm$DD$ms$DD";

    my($time)="";
    $ampm="";
    $date="";

    # Substitute all special time expressions.
    if (/(^|[^a-z])$timeexp($|[^a-z])/i) {
      $tmp=$2;
      $tmp=$Lang{$L}{"TimesH"}{lc($tmp)};
      s/(^|[^a-z])$timeexp($|[^a-z])/$1 $tmp $3/i;
    }

    # Remove some punctuation
    s/[,]/ /g;

    # When we have a digit followed immediately by a timezone (7EST), we
    # will put a space between the digit, EXCEPT in the case of a single
    # character military timezone.  If the single character is followed
    # by anything, no space is added.
    $tmp = "";
    while ( s/^(.*?\d)$zone(\s|$|[0-9])/$3/i ) {
      my($bef,$z,$aft) = ($1,$2,$3);
      if (length($z) != 1  ||  length($aft) == 0) {
        $tmp .= "$bef $z";
      } else {
        $tmp .= "$bef$z";
      }
    }
    $_ = "$tmp$_";
    $zone = '\s+' . $zone . '(?:\s+|$)';

    # Remove the time
    $iso=1;
    $midnight=0;
    $from="24${hm}00(?:${ms}00)?";
    $falsefrom="${hm}24${ms}00";   # Don't trap XX:24:00
    $to="00${hm}00${ms}00";
    $midnight=1  if (!/$falsefrom/  &&  s/$from/$to/);

    $h=$mn=$s=0;
    if (/$D$mnsec/i || /$ampmexp/i) {
      $iso=0;
      $tmp=0;
      $tmp=1  if (/$mnsec$zone2?\s*$/i  or /$mnsec$zone\s*$/i);
      $tmp=0  if (/$ampmexp/i);
      if (s/$apachetime$zone()/$1 /i                            ||
          s/$apachetime$zone2?/$1 /i                            ||
          s/(^|[^a-z])$at\s*$D$mnsec$zone()/$1 /i               ||
          s/(^|[^a-z])$at\s*$D$mnsec$zone2?/$1 /i               ||
          s/(^|[^0-9])(\d)$mnsec$zone()/$1 /i                   ||
          s/(^|[^0-9])(\d)$mnsec$zone2?/$1 /i                   ||
          (s/(t)$D$mnsec$zone()/$1 /i and (($iso=$tmp) || 1))   ||
          (s/(t)$D$mnsec$zone2?/$1 /i and (($iso=$tmp) || 1))   ||
          (s/()$DD$mnsec$zone()/ /i and (($iso=$tmp) || 1))     ||
          (s/()$DD$mnsec$zone2?/ /i and (($iso=$tmp) || 1))     ||
          s/(^|$at\s*|\s+)$D()()\s*$ampmexp$zone()/ /i          ||
          s/(^|$at\s*|\s+)$D()()\s*$ampmexp$zone2?/ /i          ||
          0
         ) {
        ($h,$mn,$s,$ampm,$z,$z2)=($2,$3,$4,$5,$6,$7);
        if (defined ($z)) {
          if ($z =~ /^[+-]\d{2}:\d{2}$/) {
            $z=~ s/://;
          } elsif ($z =~ /^[+-]\d{2}$/) {
            $z .= "00";
          }
        }
        $time=1;
        Date_TimeCheck(\$h,\$mn,\$s,\$ampm);
        $y=$m=$d="";
        # We're going to be calling TimeCheck again below (when we check the
        # final date), so get rid of $ampm so that we don't have an error
        # due to "15:30:00 PM".  It'll get reset below.
        $ampm="";
        if (/^\s*$/) {
          Date_Init()  if (! $Cnf{"UpdateCurrTZ"});
          last PARSE;
        }
      }
    }
    $time=0  if ($time ne "1");
    s/\s+$//;
    s/^\s+//;

    # if a zone was found, get rid of the regexps
    if ($z) {
      $zone="";
      $zone2="";
=10=

1.4|5|6|7|8|9| < PREV = PAGE 10 = NEXT > |11|12|13|14|15|16.76

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.00767088 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)