GPS,UTC和本地时间的显示器
2017-10-22 18:43
495 查看
GPS,UTC和本地时间的显示器
GitHub仓库:https://github.com/XinLiGitHub/GpsUtcAndLocalTime
PS:博文不再更新,后续更新会在GitHub仓库进行。
GPS,UTC和本地时间的显示器。程序中涉及到朱利安日期的转换,详细介绍见维基百科[Julian day](https://en.wikipedia.org/wiki/Julian_day)。
1,开发环境
1,操作系统:Windows 10 专业版
2,IDE:Visual Studio 2015 专业版
2,程序源码
DateTime.h文件
DateTime.c文件
main.c文件
3,运行效果
GitHub仓库:https://github.com/XinLiGitHub/GpsUtcAndLocalTime
PS:博文不再更新,后续更新会在GitHub仓库进行。
GPS,UTC和本地时间的显示器。程序中涉及到朱利安日期的转换,详细介绍见维基百科[Julian day](https://en.wikipedia.org/wiki/Julian_day)。
1,开发环境
1,操作系统:Windows 10 专业版
2,IDE:Visual Studio 2015 专业版
2,程序源码
DateTime.h文件
/**************************************************************** * Copyright (C) 2017, XinLi, all right reserved. * File name: DateTime.h * Date: 2017.10.17 * Description: Date and time module header file. *****************************************************************/ #ifndef __DATETIME_H #define __DATETIME_H /**************************************************************** * Header include *****************************************************************/ /**************************************************************** * Macro definition *****************************************************************/ /**************************************************************** * Type definition *****************************************************************/ /**************************************************************** * Structure definition *****************************************************************/ typedef struct { int year; int month; int day; int hour; int minute; int second; }DateTime; typedef struct { int week; int second; }GpsWeekSecond; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /**************************************************************** * Variable declaration *****************************************************************/ /**************************************************************** * Function declaration *****************************************************************/ DateTime GregorianCalendarDateAddYear(DateTime time, int year); DateTime GregorianCalendarDateAddMonth(DateTime time, int month); DateTime GregorianCalendarDateAddWeek(DateTime time, int week); DateTime GregorianCalendarDateAddDay(DateTime time, int day); DateTime GregorianCalendarDateAddHour(DateTime time, int hour); DateTime GregorianCalendarDateAddMinute(DateTime time, int minute); DateTime GregorianCalendarDateAddSecond(DateTime time, int second); GpsWeekSecond GregorianCalendarDateToGpsWeekSecond(DateTime time); double GregorianCalendarDateToJulianDate(DateTime time); double GregorianCalendarDateToModifiedJulianDate(DateTime time); GpsWeekSecond GpsWeekSecondAddYear(GpsWeekSecond time, int year); GpsWeekSecond GpsWeekSecondAddMonth(GpsWeekSecond time, int month); GpsWeekSecond GpsWeekSecondAddWeek(GpsWeekSecond time, int week); GpsWeekSecond GpsWeekSecondAddDay(GpsWeekSecond time, int day); GpsWeekSecond GpsWeekSecondAddHour(GpsWeekSecond time, int hour); GpsWeekSecond GpsWeekSecondAddMinute(GpsWeekSecond time, int minute); GpsWeekSecond GpsWeekSecondAddSecond(GpsWeekSecond time, int second); DateTime GpsWeekSecondToGregorianCalendarDate(GpsWeekSecond time); double GpsWeekSecondToJulianDate(GpsWeekSecond time); double GpsWeekSecondToModifiedJulianDate(GpsWeekSecond time); double JulianDateAddYear(double jd, int year); double JulianDateAddMonth(double jd, int month); double JulianDateAddWeek(double jd, int week); double JulianDateAddDay(double jd, int day); double JulianDateAddHour(double jd, int hour); double JulianDateAddMinute(double jd, int minute); double JulianDateAddSecond(double jd, int second); DateTime JulianDateToGregorianCalendarDate(double jd); GpsWeekSecond JulianDateToGpsWeekSecond(double jd); double JulianDateToModifiedJulianDate(double jd); double ModifiedJulianDateAddYear(double mjd, int year); double ModifiedJulianDateAddMonth(double mjd, int month); double ModifiedJulianDateAddWeek(double mjd, int week); double ModifiedJulianDateAddDay(double mjd, int day); double ModifiedJulianDateAddHour(double mjd, int hour); double ModifiedJulianDateAddMinute(double mjd, int minute); double ModifiedJulianDateAddSecond(double mjd, int second); DateTime ModifiedJulianDateToGregorianCalendarDate(double mjd); GpsWeekSecond ModifiedJulianDateToGpsWeekSecond(double mjd); double ModifiedJulianDateToJulianDate(double mjd); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __DATETIME_H */
DateTime.c文件
/**************************************************************** * Copyright (C) 2017, XinLi, all right reserved. * File name: DateTime.c * Date: 2017.10.17 * Description: Date and time module source file. *****************************************************************/ /**************************************************************** * Header include *****************************************************************/ #include "DateTime.h" /**************************************************************** * Global variables *****************************************************************/ /**************************************************************** * Function declaration *****************************************************************/ /**************************************************************** * Function definition *****************************************************************/ /**************************************************************** * Function: GregorianCalendarDateAddYear * Description: Gregorian calendar date add year. * Input: time: Gregorian calendar date. * year: The number of year to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ 4000 DateTime GregorianCalendarDateAddYear(DateTime time, int year) { time.year += year; if(time.month == 2) { int mday = 0; if((((time.year % 4) == 0) && ((time.year % 100) != 0)) || ((time.year % 400) == 0)) { mday = 29; } else { mday = 28; } if(time.day > mday) { time.month += 1; time.day -= mday; } } return time; } /**************************************************************** * Function: GregorianCalendarDateAddMonth * Description: Gregorian calendar date add month. * Input: time: Gregorian calendar date. * month: The number of month to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GregorianCalendarDateAddMonth(DateTime time, int month) { time.year += month / 12; time.month += month % 12; if(time.month > 12) { time.year += 1; time.month -= 12; } int mday = 0; if((time.month == 1) || (time.month == 3) || (time.month == 5) || (time.month == 7) || (time.month == 8) || (time.month == 10) || (time.month == 12)) { mday = 31; } else if((time.month == 4) || (time.month == 6) || (time.month == 9) || (time.month == 11)) { mday = 30; } else { if((((time.year % 4) == 0) && ((time.year % 100) != 0)) || ((time.year % 400) == 0)) { mday = 29; } else { mday = 28; } } if(time.day > mday) { time.month += 1; time.day -= mday; if(time.month > 12) { time.year += 1; time.month -= 12; } } return time; } /**************************************************************** * Function: GregorianCalendarDateAddWeek * Description: Gregorian calendar date add week. * Input: time: Gregorian calendar date. * week: The number of week to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GregorianCalendarDateAddWeek(DateTime time, int week) { double jd = GregorianCalendarDateToJulianDate(time) + week * 7.0; return JulianDateToGregorianCalendarDate(jd); } /**************************************************************** * Function: GregorianCalendarDateAddDay * Description: Gregorian calendar date add day. * Input: time: Gregorian calendar date. * day: The number of day to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GregorianCalendarDateAddDay(DateTime time, int day) { double jd = GregorianCalendarDateToJulianDate(time) + day; return JulianDateToGregorianCalendarDate(jd); } /**************************************************************** * Function: GregorianCalendarDateAddHour * Description: Gregorian calendar date add hour. * Input: time: Gregorian calendar date. * hour: The number of hour to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GregorianCalendarDateAddHour(DateTime time, int hour) { time.hour += hour; double jd = GregorianCalendarDateToJulianDate(time); return JulianDateToGregorianCalendarDate(jd); } /**************************************************************** * Function: GregorianCalendarDateAddMinute * Description: Gregorian calendar date add minute. * Input: time: Gregorian calendar date. * minute: The number of minute to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GregorianCalendarDateAddMinute(DateTime time, int minute) { time.minute += minute; double jd = GregorianCalendarDateToJulianDate(time); return JulianDateToGregorianCalendarDate(jd); } /**************************************************************** * Function: GregorianCalendarDateAddSecond * Description: Gregorian calendar date add second. * Input: time: Gregorian calendar date. * second: The number of seconds to add. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GregorianCalendarDateAddSecond(DateTime time, int second) { time.second += second; double jd = GregorianCalendarDateToJulianDate(time); return JulianDateToGregorianCalendarDate(jd); } /**************************************************************** * Function: GregorianCalendarDateToGpsWeekSecond * Description: Gregorian calendar date to gps week and second. * Input: time: Gregorian calendar date. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GregorianCalendarDateToGpsWeekSecond(DateTime time) { double jd = GregorianCalendarDateToJulianDate(time); return JulianDateToGpsWeekSecond(jd); } /**************************************************************** * Function: GregorianCalendarDateToJulianDate * Description: Gregorian calendar date to julian date. * Input: time: Gregorian calendar date. * Output: * Return: Julian date. *****************************************************************/ double GregorianCalendarDateToJulianDate(DateTime time) { int jdn = (1461 * (time.year + 4800 + (time.month - 14) / 12)) / 4 + (367 * (time.month - 2 - 12 * ((time.month - 14) / 12))) / 12 - (3 * ((time.year + 4900 + (time.month - 14) / 12) / 100)) / 4 + time.day - 32075; double jd = jdn + ((time.hour - 12) * 3600.0 + time.minute * 60.0 + time.second) / 86400.0; return jd; } /**************************************************************** * Function: GregorianCalendarDateToModifiedJulianDate * Description: Gregorian calendar date to modified julian date. * Input: time: Gregorian calendar date. * Output: * Return: Modified julian date. *****************************************************************/ double GregorianCalendarDateToModifiedJulianDate(DateTime time) { return GregorianCalendarDateToJulianDate(time) - 2400000.5; } /**************************************************************** * Function: GpsWeekSecondAddYear * Description: Gps week and second add year. * Input: time: Gps week and second. * year: The number of year to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddYear(GpsWeekSecond time, int year) { DateTime date = GpsWeekSecondToGregorianCalendarDate(time); date = GregorianCalendarDateAddYear(date, year); return GregorianCalendarDateToGpsWeekSecond(date); } /**************************************************************** * Function: GpsWeekSecondAddMonth * Description: Gps week and second add month. * Input: time: Gps week and second. * month: The number of month to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddMonth(GpsWeekSecond time, int month) { DateTime date = GpsWeekSecondToGregorianCalendarDate(time); date = GregorianCalendarDateAddMonth(date, month); return GregorianCalendarDateToGpsWeekSecond(date); } /**************************************************************** * Function: GpsWeekSecondAddWeek * Description: Gps week and second add week. * Input: time: Gps week and second. * week: The number of week to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddWeek(GpsWeekSecond time, int week) { time.week += week; return time; } /**************************************************************** * Function: GpsWeekSecondAddDay * Description: Gps week and second add day. * Input: time: Gps week and second. * day: The number of day to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddDay(GpsWeekSecond time, int day) { time.week += day / 7; time.second += day % 7 * 86400; if(time.second > 604799) { time.week += 1; time.second -= 604800; } return time; } /**************************************************************** * Function: GpsWeekSecondAddHour * Description: Gps week and second add hour. * Input: time: Gps week and second. * hour: The number of hour to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddHour(GpsWeekSecond time, int hour) { time.week += hour / 168; time.second += hour % 168 * 3600; if(time.second > 604799) { time.week += 1; time.second -= 604800; } return time; } /**************************************************************** * Function: GpsWeekSecondAddMinute * Description: Gps week and second add minute. * Input: time: Gps week and second. * minute: The number of minute to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddMinute(GpsWeekSecond time, int minute) { time.week += minute / 10080; time.second += minute % 10080 * 60; if(time.second > 604799) { time.week += 1; time.second -= 604800; } return time; } /**************************************************************** * Function: GpsWeekSecondAddSecond * Description: Gps week and second add second. * Input: time: Gps week and second. * second: The number of second to add. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond GpsWeekSecondAddSecond(GpsWeekSecond time, int second) { time.week += second / 604800; time.second += second % 604800; if(time.second > 604799) { time.week += 1; time.second -= 604800; } return time; } /**************************************************************** * Function: GpsWeekSecondToGregorianCalendarDate * Description: Gps week and second to gregorian calendar date. * Input: time: Gps week and second. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime GpsWeekSecondToGregorianCalendarDate(GpsWeekSecond time) { double jd = GpsWeekSecondToJulianDate(time); return JulianDateToGregorianCalendarDate(jd); } /**************************************************************** * Function: GpsWeekSecondToJulianDate * Description: Gps week and second to julian date. * Input: time: Gps week and second. * Output: * Return: Julian date. *****************************************************************/ double GpsWeekSecondToJulianDate(GpsWeekSecond time) { double jd = 2444244.5 + time.week * 7.0 + time.second / 86400.0; return jd; } /**************************************************************** * Function: GpsWeekSecondToModifiedJulianDate * Description: Gps week and second to modified julian date. * Input: time: Gps week and second. * Output: * Return: Modified julian date. *****************************************************************/ double GpsWeekSecondToModifiedJulianDate(GpsWeekSecond time) { return GpsWeekSecondToJulianDate(time) - 2400000.5; } /**************************************************************** * Function: JulianDateAddYear * Description: Julian date add year. * Input: jd: Julian date. * year: The number of year to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddYear(double jd, int year) { DateTime date = JulianDateToGregorianCalendarDate(jd); date = GregorianCalendarDateAddYear(date, year); return GregorianCalendarDateToJulianDate(date); } /**************************************************************** * Function: JulianDateAddMonth * Description: Julian date add month. * Input: jd: Julian date. * month: The number of month to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddMonth(double jd, int month) { DateTime date = JulianDateToGregorianCalendarDate(jd); date = GregorianCalendarDateAddMonth(date, month); return GregorianCalendarDateToJulianDate(date); } /**************************************************************** * Function: JulianDateAddWeek * Description: Julian date add week. * Input: jd: Julian date. * week: The number of week to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddWeek(double jd, int week) { jd += week * 7.0; return jd; } /**************************************************************** * Function: JulianDateAddDay * Description: Julian date add day. * Input: jd: Julian date. * day: The number of day to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddDay(double jd, int day) { jd += day; return jd; } /**************************************************************** * Function: JulianDateAddHour * Description: Julian date add hour. * Input: jd: Julian date. * hour: The number of hour to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddHour(double jd, int hour) { jd += hour / 24.0; return jd; } /**************************************************************** * Function: JulianDateAddMinute * Description: Julian date add minute. * Input: jd: Julian date. * minute: The number of minute to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddMinute(double jd, int minute) { jd += minute / 1440.0; return jd; } /**************************************************************** * Function: JulianDateAddSecond * Description: Julian date add second. * Input: jd: Julian date. * second: The number of second to add. * Output: * Return: Julian date. *****************************************************************/ double JulianDateAddSecond(double jd, int second) { jd += second / 86400.0; return jd; } /**************************************************************** * Function: JulianDateToGregorianCalendarDate * Description: Julian date to gregorian calendar date. * Input: jd: Julian date. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime JulianDateToGregorianCalendarDate(double jd) { int y = 4716; int j = 1401; int m = 2; int n = 12; int r = 4; int p = 1461; int v = 3; int u = 5; int s = 153; int w = 2; int b = 274277; int c = -38; int jdn = (int)(jd + 0.5); int f = jdn + j + (((4 * jdn + b) / 146097) * 3) / 4 + c; int e = r * f + v; int g = (e % p) / r; int h = u * g + w; DateTime time = {0}; time.day = (h % s) / u + 1; time.month = (h / s + m) % n + 1; time.year = e / p - y + (n + m - time.month) / n; time.hour = (int)((jd + 0.5 - jdn) * 86400.5) / 3600; time.minute = (int)((jd + 0.5 - jdn) * 86400.5 - time.hour * 3600) / 60; time.second = (int)((jd + 0.5 - jdn) * 86400.5 - time.hour * 3600 - time.minute * 60); return time; } /**************************************************************** * Function: JulianDateToGpsWeekSecond * Description: Julian date to gps week and second. * Input: jd: Julian date. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond JulianDateToGp d167 sWeekSecond(double jd) { GpsWeekSecond time = {0}; DateTime date = JulianDateToGregorianCalendarDate(jd); time.week = (int)(jd - 2444244.5) / 7; time.second = ((int)(jd - 2444244.5) - time.week * 7) * 86400 + date.hour * 3600 + date.minute * 60 + date.second; return time; } /**************************************************************** * Function: JulianDateToModifiedJulianDate * Description: Julian date to modified julian date. * Input: jd: Julian date. * Output: * Return: Modified julian date. *****************************************************************/ double JulianDateToModifiedJulianDate(double jd) { double mjd = jd - 2400000.5; return mjd; } /**************************************************************** * Function: ModifiedJulianDateAddYear * Description: Modified julian date add year. * Input: mjd: Modified julian date. * year: The number of year to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddYear(double mjd, int year) { DateTime date = ModifiedJulianDateToGregorianCalendarDate(mjd); date = GregorianCalendarDateAddYear(date, year); return GregorianCalendarDateToModifiedJulianDate(date); } /**************************************************************** * Function: ModifiedJulianDateAddMonth * Description: Modified julian date add month. * Input: mjd: Modified julian date. * month: The number of month to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddMonth(double mjd, int month) { DateTime date = ModifiedJulianDateToGregorianCalendarDate(mjd); date = GregorianCalendarDateAddMonth(date, month); return GregorianCalendarDateToModifiedJulianDate(date); } /**************************************************************** * Function: ModifiedJulianDateAddWeek * Description: Modified julian date add week. * Input: mjd: Modified julian date. * week: The number of week to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddWeek(double mjd, int week) { mjd += week * 7.0; return mjd; } /**************************************************************** * Function: ModifiedJulianDateAddDay * Description: Modified julian date add day. * Input: mjd: Modified julian date. * day: The number of day to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddDay(double mjd, int day) { mjd += day; return mjd; } /**************************************************************** * Function: ModifiedJulianDateAddHour * Description: Modified julian date add hour. * Input: mjd: Modified julian date. * hour: The number of hour to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddHour(double mjd, int hour) { mjd += hour / 24.0; return mjd; } /**************************************************************** * Function: ModifiedJulianDateAddMinute * Description: Modified julian date add minute. * Input: mjd: Modified julian date. * minute: The number of minute to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddMinute(double mjd, int minute) { mjd += minute / 1440.0; return mjd; } /**************************************************************** * Function: ModifiedJulianDateAddSecond * Description: Modified julian date add second. * Input: mjd: Modified julian date. * second: The number of second to add. * Output: * Return: Modified julian date. *****************************************************************/ double ModifiedJulianDateAddSecond(double mjd, int second) { mjd += second / 86400.0; return mjd; } /**************************************************************** * Function: ModifiedJulianDateToGregorianCalendarDate * Description: Modified julian date to gregorian calendar date. * Input: mjd: Modified julian date. * Output: * Return: Gregorian calendar date. *****************************************************************/ DateTime ModifiedJulianDateToGregorianCalendarDate(double mjd) { return JulianDateToGregorianCalendarDate(mjd + 2400000.5); } /**************************************************************** * Function: ModifiedJulianDateToGpsWeekSecond * Description: Modified julian date to gps week and second. * Input: mjd: Modified julian date. * Output: * Return: Gps week and second. *****************************************************************/ GpsWeekSecond ModifiedJulianDateToGpsWeekSecond(double mjd) { return JulianDateToGpsWeekSecond(mjd + 2400000.5); } /**************************************************************** * Function: ModifiedJulianDateToJulianDate * Description: Modified julian date to julian date. * Input: mjd: Modified julian date. * Output: * Return: Julian date. *****************************************************************/ double ModifiedJulianDateToJulianDate(double mjd) { double jd = mjd + 2400000.5; return jd; }
main.c文件
/**************************************************************** * Copyright (C) 2017, XinLi, all right reserved. * File name: main.c * Date: 2017.10.17 * Description: GPS, UTC and local time displays. *****************************************************************/ /**************************************************************** * Header include *****************************************************************/ #include "DateTime.h" #include <stdint.h> #include <stdio.h> #include <time.h> #include <windows.h> /**************************************************************** * Global variables *****************************************************************/ /**************************************************************** * Function declaration *****************************************************************/ static void gotoxy(int x, int y); /**************************************************************** * Function definition *****************************************************************/ /**************************************************************** * Function: main * Description: Program entry. * Input: * Output: * Return: *****************************************************************/ int main(void) { for(;;) { time_t times = 0; double mjd = 0.0; DateTime utctime = {.year = 1970, .month = 1, .day = 1, .hour = 0, .minute = 0, .second = 0}; DateTime localtime = {.year = 1970, .month = 1, .day = 1, .hour = 8, .minute = 0, .second = 0}; DateTime gpstime = {.year = 1970, .month = 1, .day = 1, .hour = 0, .minute = 0, .second = 0}; GpsWeekSecond gpstimews = {0}; time(×); if(times > INT32_MAX) { utctime = GregorianCalendarDateAddSecond(utctime, INT32_MAX); utctime = GregorianCalendarDateAddSecond(utctime, (int)(times - INT32_MAX)); } else { utctime = GregorianCalendarDateAddSecond(utctime, (int)times); } mjd = GregorianCalendarDateToModifiedJulianDate(utctime); localtime = GregorianCalendarDateAddHour(utctime, 8); gpstime = GregorianCalendarDateAddSecond(utctime, 18); gpstimews = GregorianCalendarDateToGpsWeekSecond(gpstime); gotoxy(0, 0); printf("Local | %d-%.2d-%.2d %.2d:%.2d:%.2d | timezone UTC+8\n", localtime.year, localtime.month, localtime.day, localtime.hour, localtime.minute, localtime.second); printf("UTC | %d-%.2d-%.2d %.2d:%.2d:%.2d | MJD %.5f\n", utctime.year, utctime.month, utctime.day, utctime.hour, utctime.minute, utctime.second, mjd); printf("GPS | %d-%.2d-%.2d %.2d:%.2d:%.2d | week %d %d s\n", gpstime.year, gpstime.month, gpstime.day, gpstime.hour, gpstime.minute, gpstime.second, gpstimews.week, gpstimews.second); Sleep(100); } } /**************************************************************** * Function: gotoxy * Description: Move the cursor to the specified position on the text screen. * Input: x: X axis coordinates. * y: Y axis coordinates. * Output: * Return: *****************************************************************/ static void gotoxy(int x, int y) { COORD pos = {x, y}; HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hOut, pos); }
3,运行效果
相关文章推荐
- 本地时间与UTC(世界协调时间)的转换
- Windows的本地时间(LocalTime)、系统时间(SystemTime)、格林威治时间(UTC-Time)、文件时间(FileTime)之间的转换
- 格式化UTC时间为本地时间
- PHP中关于时间(戳)、时区、本地时间、UTC时间等的梳理
- 记录下本地时间转utc时间的方法,参考大神的帖子
- SQL Server 本地时间和UTC时间的相互转换的代码
- 时间:UTC时间、GMT时间、本地时间、Unix时间戳
- iOS 本地时间、UTC时间、时间戳等操作、获取当前年月日
- jQuery 将本地时间转换成 UTC 时间,计算时差,将UTC时间转换成 本地 时间
- SQL Server本地时间和UTC时间的相互转换实现代码
- 时间:UTC时间、GMT时间、本地时间、Unix时间戳
- 本地时间和UTC时间 转换
- Windows的本地时间(LocalTime)、系统时间(SystemTime)、格林威治时间(UTC-Time)、文件时间(FileTime)之间的转换
- 在编程中UTC时间和本地时间(LocalTime)的区别
- UTC 转本地时间
- java本地时间与UTC时间相互转换
- UTC时间转为本地时间
- [C/C++标准库]_[初级]_[转换UTC时间到local本地时间]
- GPS UTC与北京时间的转换函数
- 如何把本地时间转换成UTC(通用时间)