jasctime.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 89 行
C
89 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#include "variety.h"
#include <stdio.h>
#include <jtime.h>
#define TMSZ 37
static const char *dtbl[] = {"擔","寧","壩","悈","栘","嬥","搚"};
static unsigned char s[TMSZ];
/**
*
* Name: jasctime
*
* Synopsis: s = jasctime( t )
*
* unsigned char *s; ASCII 暥帤楍
* struct tm *t; 擖椡偺 tm 峔憿懱
*
* Description: tm 峔憿懱偺抣傪埲壓偺宍幃偺暥帤楍偵曄姺偡傞丅
*
* YYYY 擭 MM 寧 dd 擔 (DD) hh:mm:ss\n\0
*
* DD 偼梛擔丄MM 偼寧丄dd 偼擔晅丄hh:mm:ss 偼帪丗暘丗昩丄
* YYYY 偼擭偱偁傞丅
*
*
* Name: jasctime
*
* Synopsis: s = jasctime( t )
*
* unsigned char *s; ASCII string returned
* struct tm *t; input tm structure
*
* Description: Represent the tm structure as a string in the form
*
* YYYY 擭 MM 寧 dd 擔 (DD) hh:mm:ss\n\0
*
* where DD is the day of the week, MM is the month, dd is
* the day of the month, hh:mm:ss is the hour:minute:seconds,
* and YYYY is the year.
*
**/
_WCRTLINK unsigned char *jasctime( const struct tm *t )
{
/* 1234567890 123456 7890123456789 012 345 6 7*/
sprintf( s, "%04d 擭 %2d 寧 %2d 擔 乮%s乯 %02d:%02d:%02d\n",
t->tm_year+1900,
t->tm_mon+1,
t->tm_mday,
dtbl[t->tm_wday],
t->tm_hour,
t->tm_min,
t->tm_sec );
return( s );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?