FW: local timezone

2004-02-06 Thread Ilya A. Tereshchenko
 | 
FORMAT_MESSAGE_IGNORE_INSERTS,
  NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //
Default language
  (LPTSTR) lpMsgBuf,
0,
NULL 
  );
printf(Cannot obtain timezone information
(%s)\n,
(const char *) lpMsgBuf);
}
return -1;

default:
printf(Cannot obtain timezone information: unknown
return value (%d)\n,
dwRet);
return -1;
}

const int ciDim = 40;
char buff[ciDim];

printf(Bias: %d\n, sTZ.Bias);

size_t size = wcstombs(0, sTZ.StandardName, -1);
if (size == (size_t) -1 || size = ciDim)
{
printf(Not enough space to convert name (%d needed)\n,
size);
}
else
{
wcstombs(buff, sTZ.StandardName, -1);
printf(StandardName: %s\n, buff);
}

printf(StandardDate: );
PrintTime(sTZ.StandardDate);

printf(StandardBias: %d\n, sTZ.StandardBias);

size = wcstombs(0, sTZ.DaylightName, -1);
if (size == (size_t) -1 || size = ciDim)
{
printf(Not enough space to convert name (%d needed)\n,
size);
}
else
{
wcstombs(buff, sTZ.DaylightName, -1);
printf(DaylightName : %s\n, buff);
}

printf(DaylightDate: );
PrintTime(sTZ.DaylightDate);

printf(DaylightBias: %d\n, sTZ.DaylightBias);


return 0;
}

-

TIME_ZONE_ID_STANDARD:
Bias: -360
StandardName: N. Central Asia Standard Time
StandardDate:  10 05 03:00:00 (0 dow, 0 milliseconds)
StandardBias: 0
DaylightName : N. Central Asia Standard Time
DaylightDate:  03 05 02:00:00 (0 dow, 0 milliseconds)
DaylightBias: -60

   Best regards, Elliot.
 

---
Ilya A. Tereshchenko
Developer
Aurorisoft Inc.
 
E-mail: [EMAIL PROTECTED]
For more visit http://www.aurorisoft.com/

--- 

 -Original Message-
 From: Dave Rolsky [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 06, 2004 6:42 AM
 To: Jamie LeTual
 Cc: datetime
 Subject: Re: local timezone
 

[skip]

 The problem is that DateTime wants something like America/New_York, not
 Atlantic Standard Time, whichi isn't really the right timezone, most
 likely.  AST, which is probably the same as EST, is only valid for half of
 the year on most of the US Atlantic coast.
 
 So we don't want to know what the current offset is, instead we want to
 know the geo-political time zone name.



local timezone

2004-02-04 Thread Ilya A. Tereshchenko
Hello!

I have a problem with DateTime::set_time_zone(local) call: it says that
cannot determine local timezone. Actually, this behavior appeared when I
upgraded DateTime modules (and relatves). After little investigation I found
that since v0.12 (that I used before) there was changed local timezone
determination algorithm and, the following lines are disappeared:

 

my @t = gmtime;

 

my $local = Time::Local::timelocal(@t);

my $gm= Time::Local::timegm(@t);

 

return

DateTime::TimeZone::OffsetOnly-new

( offset = offset_as_string( $gm - $local ) );

 

What was the reason of cutting off that method? Yes, there are several new
methods of local timezone determination appeared, but all of them applicable
only under UNIX systems. Unfortunately, my script should work under Windows
and, therefore, I have lost a chance to determine local timezone. The only
way left under Windows is to use environment variable, but this method
scarcely applicable for me too: the script will be used by customer and I
can't guarantee that TZ variable always will be set properly. For the
moment, I used a hack - I added several strings to
DateTime::TimeZone::Local:

 

sub local_time_zone

{

my $tz;

 

foreach ( qw( _from_env _from_etc_localtime _from_etc_timezone

  _from_etc_sysconfig_clock _old_plain) )

{

$tz = __PACKAGE__-$_();

return $tz if $tz;

}

 

die Cannot determine local time zone\n;

}

 

sub _old_plain

{

  my @t = gmtime;

 

  my $local = Time::Local::timelocal(@t);

  my $gm= Time::Local::timegm(@t);

 

  return

  DateTime::TimeZone::OffsetOnly-new

  ( offset = DateTime::TimeZone::offset_as_string( $gm - $local )
);

}

 

Could anybody suggest a more suitable way? Or, maybe, just add something
like I wrote above into DateTime::TimeZone::Local?

 

   Best regards, Elliot.

 


---
Ilya A. Tereshchenko
Developer

Aurorisoft Inc.

 

E-mail: [EMAIL PROTECTED]
For more visit http://www.aurorisoft.com/ http://www.novosoft-usa.com/ 

--- 

 



FW: Date::Time 0.12

2003-06-20 Thread Ilya A. Tereshchenko
Hello,
 
I've failed reach Dave Rolsky (some problem with urth.org domain
resolving), so I forwarding to mail list. Hope Dave reads it.
 
   Best regards, Elliot.
 

---
Ilya A. Tereshchenko
Developer
Aurorisoft Inc.
 
E-mail:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
For more visit  http://www.aurorisoft.com/ http://www.aurorisoft.com/
http://www.novosoft-usa.com/ 

--- 
-Original Message-
From: Ilya A. Tereshchenko [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 20, 2003 1:11 PM
To: '[EMAIL PROTECTED]'
Subject: Date::Time 0.12
 
Hello Dave,
 
I've tried you most recent Date::Time module (0.12) got from CPAN and
found some problems building it. Here is a list:
1)   Under Win32 'finite' function is called '_finite'. I know, it's
Microsoft feature, but I suppose you can tune your makefile to avoid it
:-).
2)   I don't know if this is related to the same 'finite/_finite'
function, but 4 test have failed on my machine. Here is a log:
t\20infinite...ok 7/36# Failed test (t\20infinite.t at line 48)
# Failed test (t\20infinite.t at line 55)
t\20infinite...NOK 12#  got: '-2147483648'
# expected: '-1.#IND'
# Failed test (t\20infinite.t at line 55)
t\20infinite...NOK 13#  got: '-2147483648'
# expected: '-1.#IND'
# Failed test (t\20infinite.t at line 55)
t\20infinite...NOK 14#  got: '0'
# expected: '-1.#IND'
t\20infinite...ok 19/36# Looks like you failed 4 tests of 36.
t\20infinite...dubious
Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 11-14
Failed 4/36 tests, 88.89% okay
Failed TestStat Wstat Total Fail  Failed  List of Failed

---
t\20infinite.t4  1024364  11.11%  11-14
Failed 1/21 test scripts, 95.24% okay. 4/1369 subtests failed, 99.71%
okay.
NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x2'
Stop.
 
Hope you can say something about these problems.
 
   Best regards, Elliot.
 
P.S.: Also, I've built your module third time and third time wonder why
don't you assemble all DateTime-LeapSecond, DateTime-TimeZone and
DateTime itself into one module? :-)