Specifying non-local time zone in GlobalConfiguration fails on Linux - atata

My tests will be running on a variety of machines/containers scattered all across the USA, so I would like them all to log their time in Eastern Time. If I do this:
AtataContext.GlobalConfiguration.UseTimeZone(System.TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"))
All my logs generated by Windows machines work fine, but in linux (Debian 11) I get this:
Error Message:
OneTimeSetUp: System.TimeZoneNotFoundException : The time zone ID 'Eastern Standard Time' was not found on the local computer.
----> System.IO.FileNotFoundException : Could not find file '/usr/share/zoneinfo/Eastern Standard Time'.
Is there something else I need to do to get the time zone synced across all logs?

The previous answer is correct. You can find a time zone by different names depending on current OS. But in addition to that here is another solution.
You can add TimeZoneConverter NuGet package to a project and use its TZConvert class to find a time zone by either Windows or Linux time zone ID.
AtataContext.GlobalConfiguration.UseTimeZone(TZConvert.GetTimeZoneInfo("US/Eastern"));

This works:
using System;
TimeZoneInfo ET;
if (WebDriverSetup.OSInfo.IsWindows)
{
ET = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
}
else
{
ET = TimeZoneInfo.FindSystemTimeZoneById("US/Eastern");
}
AtataContext.GlobalConfiguration.UseTimeZone(ET);

Related

BESClient (BIGFIX) Linux redhat

I have a question about BESClient (bigfix ) config.
I want to install and config BESAgent-10.0.0.133-rhe6.x86_64 , using a puppet module to deploy it (on machines with RHEL6,7,8).
And I need know and understand, what does mean this parameter in config file besclient.config "effective date = Tue,%2003%20Nov%202020%2010:16:47%20+0100". I know that this is a timestamp.
I notice that , every time that puppet apply the configs on the machines, this timestamp change.
So , i donĀ“t know if this change in timestamp every time that puppet run on machines, have any bad effect on config.
The effective date only states the time stamp on which the setting was set by the bigfix client. It has no effect on the configuration itself.

Apache Time Differs from Operating System Date and time?

I have apache-tomcat-5.5.17 that I run using the terminal manually the time on the instance is not the same as the operating system , I tried to configure the apache time using php.ini , that is located in /etc/php.ini , I added :
[Date]
date.timezome="MyTimeZone"
it didn't take an effect on the instance even so I restarted the application , and the services , is there something else needs modifying ??
well guys I figured out how to solve this problem , the trick is to modify catalina.sh script and add the time zone to the java options :
-Duser.timezone="one of the Time Zones that are allowed"

TZ Variable, custom file

I have an embedded system where we wish to create custom daylight savings times.
I can achieve this by setting the TZ environment variable, for example: export TZ=IST-2IDT,M3.4.4/26,M10.5.0.
We have several daemons running (eg. daemonA, daemonB, etc.), and if one of those exports TZ then the other daemons won't be able to see it. So that's an issue. A possible work around might be to use a file instead of an environment variable so that 'everyone' can see it.
The GNU C Library manual says the following:
:characters
Each operating system interprets this format differently; in the GNU C Library, characters is the name of a file which describes the time zone.
When I export TZ=:/etc/TZ, and then echo IST-2IDT,M3.4.4/26,M10.5.0 > /etc/TZ, it doesn't work. I see this, when I issue the date command:
Mon Aug 15 04:19:36 /etc/TZ 2016
Is anybody able to give me any clues?
Thanks so much!!
Files such as /etc/TZ depend on the type of system (call them nonstandard as such, though standardization is poor in this area). The usual way timezone is configured is via the /etc/localtime files. Normally these are generated from rule (text) files by the timezone compiler. It is in the tzfile manual page for instance.
The timezone-in-date is a good place to start reading further - since it mentions a few possibilities regarding /etc/TZ. If /etc/TZ is what works for your system, the accepted answer there points to this Oracle page, which appears to document the format.

Odd Oracle + .net behaviour when comparing types

My workplace has a .net application supplied to us by a postal service, it connects to an oracle database running on the same machine and is responsible for registering, storing and printing shipping labels.
Seeing as the database host etc. is configurable we asked the company if the application could be used over the network (simply copying it over to another machine resulted in "literal does not match format string" errors), all we were told is "it isn't possible". Not wanting to take no for an answer I poked around the exe with reflector.
Together with Oracle's v$sqlarea view I pinpointed the errors to a few date comparison functions, but I have no idea why the application was working in the first place on the original machine.
The original application uses queries similar to
SELECT * FROM shipping WHERE date = '2011/03/28' --error
easily fixed with something like
SELECT * FROM shipping WHERE to_char(date, 'yyyy/mm/dd') = '2011/03/28'
Why does the original application work without throwing any errors? The incorrect query pops up in the v$sqlarea view when the application is used on the original host, if I copy the query and run it manually using anything else it throws the error, if I run the application on any other machine it throws the error too, is there some setting in Oracle that is modifying queries on the fly, but only for queries originating from the local machine, while storing the original query in v$sqlarea?
This sounds like a regional settings difference between the two client machines, since formatting of dates will be dependent on the culture used to convert the date to a string in .NET, and unless the application specifies a culture, it will use the settings of the current logged on user running the application. This is obviously a problem if the database engine is expecting them in a certain format. This problem is less likely to arise with parametrized queries, where the date parameters are passed separate from the query and as a date datatype instead of a string.
If you work with dates, you must avoid String.Format based query generation. Use parametrized selects and parameters to set those values.
OracleCommand cmd = new OracleCommand("SELECT * FROM shipping WHERE date = :dataParam", connection);
var param = cmd.Parameters.Add("date", OracleDbType.Date);
param.Value = DateTime.Now;
It worked, because the format was matching the datetime settings on the developer machine and on the target database.
In other words: the issue is connected to an incorrect date time format you are trying to provide.
This could be because of regional settings on the server. Please check that the new server is configured for the same Locale (EN-GB, EN-US, or whatever the original server is configured to use).

last-modified header and linux file system

im using httpclient and last-modified header in order to retrieve the last updated date of an html file however when i try this on a linux box it returns yesterdays date but when i use a windows machine it returns todays date. is anyone aware of issues using this header field in linux?
Perhaps, linux server has its clock set differently and this way "lives in the past"?
If you dualboot with Windows, you must make sure your Linux system is configured to not think the BIOS keeps the clock in GMT (or UTC), but in local time. Otherwise your Linux system's clock will keep being off when in Linux.
Also make sure that the /etc/localtime file is a symlink to the correct time zone file under /usr/share/zoneinfo.
After configuring those two things, verify your date and time is correct using the date command and set it correctly if it isn't, via:
date MMDDhhmmCCYY.ss
For example, for the current time at my end (19:41:27 on October 15th 2008) I would use:
date 101519412008.27
Just a thought - perhaps your filesystem was mounted with the noatime option. I'm making the assumption here that your html file wasn't modified, only accessed without changes and the 'updated' time wasn't recorded.
Can you see the timestamp of the file? Is it exactly 1 day out, or just sometime yesterday?
when i look at the date assocaiated with the time it is correct, but then the date that gets displayed after i call the http method is one day behind. Possibly a problem with caching

Resources