\hypertarget{dcdatetimezone_8f90}{}\section{dc\+\_\+utils/dcdatetimezone.f90 File Reference}
\label{dcdatetimezone_8f90}\index{dc\+\_\+utils/dcdatetimezone.\+f90@{dc\+\_\+utils/dcdatetimezone.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{dcdatetimezone_8f90_a68404e993f092882722be037ada2daee}{dcdatetimesetzone} (time, zone, err)
\item 
type(dc\+\_\+difftime) function \hyperlink{dcdatetimezone_8f90_a2f3b1b672335deba09b578f60c505177}{dcdatetimezonetodiff} (zone)
\item 
logical function \hyperlink{dcdatetimezone_8f90_a2f799c4b7055e9fca3568c88a9c7094a}{dcdatetimevalidzone} (zone)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{dcdatetimezone_8f90_a68404e993f092882722be037ada2daee}\label{dcdatetimezone_8f90_a68404e993f092882722be037ada2daee}} 
\index{dcdatetimezone.\+f90@{dcdatetimezone.\+f90}!dcdatetimesetzone@{dcdatetimesetzone}}
\index{dcdatetimesetzone@{dcdatetimesetzone}!dcdatetimezone.\+f90@{dcdatetimezone.\+f90}}
\subsubsection{\texorpdfstring{dcdatetimesetzone()}{dcdatetimesetzone()}}
{\footnotesize\ttfamily subroutine dcdatetimesetzone (\begin{DoxyParamCaption}\item[{type(dc\+\_\+datetime), intent(inout)}]{time,  }\item[{character($\ast$), intent(in)}]{zone,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



Definition at line 13 of file dcdatetimezone.\+f90.



References dc\+\_\+error\+::dc\+\_\+ebadtimezone, dc\+\_\+error\+::dc\+\_\+noerr, dc\+\_\+error\+::storeerror(), and dc\+\_\+types\+::string.


\begin{DoxyCode}
13   \textcolor{comment}{!}
14   \textcolor{comment}{! 引数 *time* のタイムゾーンを *zone* へと変更します.}
15   \textcolor{comment}{! 実質的な日時は変更しません.}
16   \textcolor{comment}{!}
17   \textcolor{comment}{! 引数 *zone* に不適切な値が与えられた場合,}
18   \textcolor{comment}{! エラーを発生させます.}
19   \textcolor{comment}{! 引数 *err* を与えている場合には *err* に .true. が返り,}
20   \textcolor{comment}{! プログラムは続行します.}
21   \textcolor{comment}{!}
22   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{,      only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
23   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__types}{dc\_date\_types}\textcolor{keywordtype}{, only}: dc\_datetime, dc\_difftime
24   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__generic}{dc\_date\_generic}\textcolor{keywordtype}{, only}: validzone, zonetodiff, \hyperlink{interfacedc__date__generic_1_1tochar}{tochar}, 
      \hyperlink{interfacedc__date__generic_1_1eval}{eval}, &
25     & \textcolor{keyword}{operator}(-), \textcolor{keyword}{operator}(+)
26   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_ace08fdbe745eff9029a6689bde03b811}{dc\_ebadtimezone}, 
      \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
27   \textcolor{keywordtype}{use }dc\_message\textcolor{keywordtype}{, only}: messagenotify
28   \textcolor{keywordtype}{use }dc\_trace\textcolor{keywordtype}{, only}: beginsub, endsub
29   \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: stoi
30   \textcolor{keywordtype}{implicit none}
31   \textcolor{keywordtype}{type}(dc\_datetime), \textcolor{keywordtype}{intent(inout)}:: time
32   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: zone
33   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
34   \textcolor{keywordtype}{type}(dc\_difftime):: diff, diff\_in
35   \textcolor{keywordtype}{integer} :: stat
36   \textcolor{keywordtype}{character(STRING)} :: zone\_in, cause\_c
37   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{parameter} :: subname = \textcolor{stringliteral}{'DCDateTimeSetZone'}
38 \textcolor{keywordflow}{continue}
39   \textcolor{keyword}{call }beginsub(subname, \textcolor{stringliteral}{'time=%c, zone=%c'}, &
40     & c1=trim(\hyperlink{interfacedc__date__generic_1_1tochar}{tochar}(time)), c2=trim(zone))
41   stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
42   cause\_c = \textcolor{stringliteral}{''}
43 
44   \textcolor{keywordflow}{if} (.not. validzone(zone)) \textcolor{keywordflow}{then}
45     stat = \hyperlink{namespacedc__error_ace08fdbe745eff9029a6689bde03b811}{dc\_ebadtimezone}
46     cause\_c = zone
47     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(err)) \textcolor{keywordflow}{then}
48       \textcolor{keyword}{call }messagenotify(\textcolor{stringliteral}{'W'}, subname, &
49         & \textcolor{stringliteral}{'zone=<%c> is invalid.'}, &
50         & c1=trim(zone))
51     \textcolor{keywordflow}{else}
52       \textcolor{keywordflow}{goto} 999
53 \textcolor{keywordflow}{    end if}
54 \textcolor{keywordflow}{  end if}
55 
56   \textcolor{keyword}{call }\hyperlink{interfacedc__date__generic_1_1eval}{eval}(time, zone = zone\_in)
57   diff\_in = zonetodiff(zone\_in)
58   diff = zonetodiff(zone)
59 
60   time = time + (diff\_in - diff)
61   time % zone = zone
62 
63 999 \textcolor{keywordflow}{continue}
64   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, subname, err, cause\_c)
65   \textcolor{keyword}{call }endsub(subname, \textcolor{stringliteral}{'time=%c'}, &
66     & c1=trim(\hyperlink{interfacedc__date__generic_1_1tochar}{tochar}(time)))
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{dcdatetimezone_8f90_a68404e993f092882722be037ada2daee_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{dcdatetimezone_8f90_a2f799c4b7055e9fca3568c88a9c7094a}\label{dcdatetimezone_8f90_a2f799c4b7055e9fca3568c88a9c7094a}} 
\index{dcdatetimezone.\+f90@{dcdatetimezone.\+f90}!dcdatetimevalidzone@{dcdatetimevalidzone}}
\index{dcdatetimevalidzone@{dcdatetimevalidzone}!dcdatetimezone.\+f90@{dcdatetimezone.\+f90}}
\subsubsection{\texorpdfstring{dcdatetimevalidzone()}{dcdatetimevalidzone()}}
{\footnotesize\ttfamily logical function dcdatetimevalidzone (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{zone }\end{DoxyParamCaption})}



Definition at line 98 of file dcdatetimezone.\+f90.


\begin{DoxyCode}
98   \textcolor{comment}{!}
99   \textcolor{comment}{! 与えられるタイムゾーンの表記が有効であれば}
100   \textcolor{comment}{! .true. を, それ以外の場合は .false. を返します.}
101   \textcolor{comment}{!}
102   \textcolor{comment}{! タイムゾーンの表記は '+09:00' のように, 1 文字目が '+' または '-',}
103   \textcolor{comment}{! 2〜3, 5〜6 文字目が数値で, 4 文字目が ':' となります.}
104   \textcolor{comment}{!}
105   \textcolor{keywordtype}{implicit none}
106   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: zone
107   \textcolor{keywordtype}{logical}:: result
108 \textcolor{keywordflow}{continue}
109   result = .false.
110   \textcolor{keywordflow}{if} (len(zone) < 6) \textcolor{keywordflow}{return}
111   \textcolor{keywordflow}{if} (verify(zone(1:1), \textcolor{stringliteral}{'+-'}) /= 0) \textcolor{keywordflow}{return}
112   \textcolor{keywordflow}{if} (verify(zone(2:3), \textcolor{stringliteral}{'1234567890'}) /= 0) \textcolor{keywordflow}{return}
113   \textcolor{keywordflow}{if} (verify(zone(5:6), \textcolor{stringliteral}{'1234567890'}) /= 0) \textcolor{keywordflow}{return}
114   \textcolor{keywordflow}{if} (zone(4:4) /= \textcolor{stringliteral}{':'}) \textcolor{keywordflow}{return}
115   result = .true.
\end{DoxyCode}
\mbox{\Hypertarget{dcdatetimezone_8f90_a2f3b1b672335deba09b578f60c505177}\label{dcdatetimezone_8f90_a2f3b1b672335deba09b578f60c505177}} 
\index{dcdatetimezone.\+f90@{dcdatetimezone.\+f90}!dcdatetimezonetodiff@{dcdatetimezonetodiff}}
\index{dcdatetimezonetodiff@{dcdatetimezonetodiff}!dcdatetimezone.\+f90@{dcdatetimezone.\+f90}}
\subsubsection{\texorpdfstring{dcdatetimezonetodiff()}{dcdatetimezonetodiff()}}
{\footnotesize\ttfamily type(dc\+\_\+difftime) function dcdatetimezonetodiff (\begin{DoxyParamCaption}\item[{character($\ast$), intent(in)}]{zone }\end{DoxyParamCaption})}



Definition at line 70 of file dcdatetimezone.\+f90.


\begin{DoxyCode}
70   \textcolor{comment}{!}
71   \textcolor{comment}{! 与えられるタイムゾーンを dc\_date\_types#DC\_DIFFTIME 変数へと}
72   \textcolor{comment}{! 変換して返します. タイムゾーンの表記が無効な場合は '+00:00'}
73   \textcolor{comment}{! が与えられたと解釈します.}
74   \textcolor{comment}{!}
75   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__types}{dc\_date\_types}\textcolor{keywordtype}{, only}: dc\_difftime
76   \textcolor{keywordtype}{use }\hyperlink{namespacedc__date__generic}{dc\_date\_generic}\textcolor{keywordtype}{, only}: validzone, \hyperlink{interfacedc__date__generic_1_1dcdifftimecreate}{dcdifftimecreate}
77   \textcolor{keywordtype}{use }dc\_string\textcolor{keywordtype}{, only}: stoi
78   \textcolor{keywordtype}{implicit none}
79   \textcolor{keywordtype}{type}(dc\_difftime):: diff
80   \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}:: zone
81   \textcolor{keywordtype}{integer}:: hour, \hyperlink{interfacedc__date__generic_1_1min}{min}, sgn
82 \textcolor{keywordflow}{continue}
83   \textcolor{keywordflow}{if} (.not. validzone(zone)) \textcolor{keywordflow}{then}
84     \textcolor{keyword}{call }\hyperlink{interfacedc__date__generic_1_1dcdifftimecreate}{dcdifftimecreate}(diff)
85   \textcolor{keywordflow}{else}
86     \textcolor{keywordflow}{if} (zone(1:1) == \textcolor{stringliteral}{'-'}) \textcolor{keywordflow}{then}
87       sgn = 1
88     \textcolor{keywordflow}{else}
89       sgn = -1
90 \textcolor{keywordflow}{    end if}
91     hour = stoi(zone(2:3))
92     \hyperlink{interfacedc__date__generic_1_1min}{min} = stoi(zone(5:6))
93     \textcolor{keyword}{call }\hyperlink{interfacedc__date__generic_1_1dcdifftimecreate}{dcdifftimecreate}(diff, hour = hour * sgn, \hyperlink{interfacedc__date__generic_1_1min}{min} = \hyperlink{interfacedc__date__generic_1_1min}{min} * sgn)
94 \textcolor{keywordflow}{  end if}
\end{DoxyCode}
