⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 04mjd.t

📁 source of perl for linux application,
💻 T
字号:
use Test;BEGIN { plan tests => 12 }# Test the calculation of (modified) Julian dateuse Time::Piece;# First a lookup table of epoch and MJD# Use 3 sig fig in MJD (hence the use of strings)# This will not work on systems that use a different reference# epoch to unix time. To be more general we should use strptime# to parse the reference date.my %mjd = (          951827696  => '51603.524', # 2000-02-29T12:34:56UT          1000011    => '40598.574', # 1970-01-12T13:46:51UT          1021605703 => '52411.140', # 2002-05-17T03:21:43UT          1121605703 => '53568.547', # 2005-07-17T13:08:23UT          1011590000 => '52295.218', # 2002-01-21T05:13:20UT          1011605703 => '52295.399', # 2002-01-21T09:35:03         );# Now loop over each MJDfor my $time (keys %mjd) {  # First check using GMT  my $tp = gmtime( $time );  ok(sprintf("%.3f",$tp->mjd),$mjd{$time});  # Now localtime should give the same answer for MJD  # since MJD is always referred to as UT  $tp = localtime( $time );  ok(sprintf("%.3f",$tp->mjd),$mjd{$time});}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -