I came to the office on Saturday to find the resolution that I didn't understand.
I installed SCOM 2007 R2 to monitor servers.
0ne functionality is that connecting to this program and getting operational data.
I knew that data collected by OpsMgr wasn't stored on local time - Korea Standard Time.
For instance, If i start monitoring program at 2 p.m., It is wright that data is stored in the database at 2 o'clock in the afternoon. However, the time of data is recorded at 5 o'clock in morning, instead.
I started to find why it was.
Firstly, Would it be because wrong setting of sever time?
I checked it It wasn't problem at all.
Secondly, Would it be because wrong setting of OprMgr?
I ran OpsMgr console and checked if there was any menu that change time settings.
I cloudn't find it.
Finally, I searched on the internet.
I realized that OpsMgr store data based on UTC(Coordinated Univerial Time).
I have to apply difference between local and GMT.
When you're supposed to get performance data from SQL Server directly, you have to use like this:
whereTimeSampled >= dateadd(hour,-6, getutcdate())
getutcdate() retuns current date & time based on UTC.
When you're using SDK in C#, you have to change the Datetime varible based on UTC
DateTime from = DateTime.UtcNow;
DateTime to = from.AddHours(-6);