资源简介
GPS时间有GPS周、GPS积年日,这些与日常公历有差别,在进行GPS数据处理的时候需要进行换算
代码片段和文件信息
// DAYTOWEEK.cpp : implementation file
//
#include “stdafx.h“
#include “GPS_Calculate.h“
#include “DAYTOWEEK.h“
#include
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDAYTOWEEK dialog
CDAYTOWEEK::CDAYTOWEEK(CWnd* pParent /*=NULL*/)
: CDialog(CDAYTOWEEK::IDD pParent)
{
//{{AFX_DATA_INIT(CDAYTOWEEK)
m_iweek = 0;
m_iyear = 0;
m_iday = 1;
m_iweekday = 0;
//}}AFX_DATA_INIT
}
void CDAYTOWEEK::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDAYTOWEEK)
DDX_Text(pDX IDC_EDIT_WEEK m_iweek);
DDV_MinMaxInt(pDX m_iweek 0 2147483647);
DDX_Text(pDX IDC_EDIT_YEAR m_iyear);
DDV_MinMaxInt(pDX m_iyear 0 2147483647);
DDX_Text(pDX IDC_EDIT_DAY m_iday);
DDV_MinMaxInt(pDX m_iday 1 366);
DDX_Text(pDX IDC_EDIT_WEEKDAY m_iweekday);
DDV_MinMaxInt(pDX m_iweekday 0 6);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDAYTOWEEK CDialog)
//{{AFX_MSG_MAP(CDAYTOWEEK)
ON_BN_CLICKED(IDC_BUTTON_WEEKtoDay OnBUTTONWEEKtoDay)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDAYTOWEEK message handlers
int CDAYTOWEEK::leap(int y)
{
return (y%4==0&&y%100||y%400==0);
}
long CDAYTOWEEK::total(int yearint day)
{
long totaldays;
int idays[]= {30312831303130313130313031};
if(leap(year))
days[2]=29;
else days[2]=28;
totaldays=day;
for(i=1;i totaldays+=(365+leap(i));
return totaldays;
}
void CDAYTOWEEK::OnBUTTONWEEKtoDay()
{
UpdateData();
long totaldayssub;
totaldays=total(m_iyearm_iday);
sub=labs(totaldays-722820);
m_iweek=sub/7;
m_iweekday=sub%7;
UpdateData(FALSE);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-04-27 16:33 GPS_Calculate\
文件 1899 2015-04-27 16:33 GPS_Calculate\DAYTOWEEK.cpp
目录 0 2015-04-27 16:33 GPS_Calculate\Debug\
文件 14047 2015-04-27 16:33 GPS_Calculate\Debug\Dayoryear.obj
文件 13135 2015-04-27 16:33 GPS_Calculate\Debug\DAYTOWEEK.obj
文件 122959 2015-04-27 16:33 GPS_Calculate\Debug\GPS_Calculate.exe
文件 329896 2015-04-27 16:33 GPS_Calculate\Debug\GPS_Calculate.ilk
文件 23467 2015-04-27 16:33 GPS_Calculate\Debug\GPS_Calculate.obj
文件 5558976 2015-04-27 16:33 GPS_Calculate\Debug\GPS_Calculate.pch
文件 484352 2015-04-27 16:33 GPS_Calculate\Debug\GPS_Calculate.pdb
文件 8296 2015-04-27 16:33 GPS_Calculate\Debug\GPS_Calculate.res
文件 15213 2015-04-27 16:33 GPS_Calculate\Debug\GPS_CalculateDoc.obj
文件 24629 2015-04-27 16:33 GPS_Calculate\Debug\GPS_CalculateView.obj
文件 20068 2015-04-27 16:33 GPS_Calculate\Debug\MainFrm.obj
文件 105791 2015-04-27 16:33 GPS_Calculate\Debug\StdAfx.obj
文件 222208 2015-04-27 16:33 GPS_Calculate\Debug\vc60.idb
文件 364544 2015-04-27 16:33 GPS_Calculate\Debug\vc60.pdb
文件 3720 2015-04-27 16:33 GPS_Calculate\GPS_Calculate.clw
文件 55808 2015-04-27 16:33 GPS_Calculate\GPS_Calculate.opt
文件 3103 2015-04-27 16:33 GPS_Calculate\GPS_CalculateView.cpp
评论
共有 条评论