本文整理汇总了C++中show_date函数的典型用法代码示例。如果您正苦于以下问题:C++ show_date函数的具体用法?C++ show_date怎么用?C++ show_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_date函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: add_user_info
static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf, const char *line)
{
char *date;
int namelen;
unsigned long time;
int tz, ret;
const char *filler = " ";
if (fmt == CMIT_FMT_ONELINE)
return 0;
date = strchr(line, '>');
if (!date)
return 0;
namelen = ++date - line;
time = strtoul(date, &date, 10);
tz = strtol(date, NULL, 10);
ret = sprintf(buf, "%s: %.*s%.*s\n", what,
(fmt == CMIT_FMT_FULLER) ? 4 : 0,
filler, namelen, line);
switch (fmt) {
case CMIT_FMT_MEDIUM:
ret += sprintf(buf + ret, "Date: %s\n", show_date(time, tz));
break;
case CMIT_FMT_FULLER:
ret += sprintf(buf + ret, "%sDate: %s\n", what, show_date(time, tz));
break;
default:
/* notin' */
break;
}
return ret;
}
开发者ID:4ker,项目名称:annotated-git-1.0,代码行数:33,代码来源:commit.c
示例2: cgit_parse_commit
static char *emit_suspect_detail(struct blame_origin *suspect)
{
struct commitinfo *info;
struct strbuf detail = STRBUF_INIT;
info = cgit_parse_commit(suspect->commit);
strbuf_addf(&detail, "author %s", info->author);
if (!ctx.cfg.noplainemail)
strbuf_addf(&detail, " %s", info->author_email);
strbuf_addf(&detail, " %s\n",
show_date(info->author_date, info->author_tz,
cgit_date_mode(DATE_ISO8601)));
strbuf_addf(&detail, "committer %s", info->committer);
if (!ctx.cfg.noplainemail)
strbuf_addf(&detail, " %s", info->committer_email);
strbuf_addf(&detail, " %s\n\n",
show_date(info->committer_date, info->committer_tz,
cgit_date_mode(DATE_ISO8601)));
strbuf_addstr(&detail, info->subject);
cgit_free_commitinfo(info);
return strbuf_detach(&detail, NULL);
}
开发者ID:johnkeeping,项目名称:cgit,代码行数:26,代码来源:ui-blame.c
示例3: pp_user_info
void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
const char *line, enum date_mode dmode,
const char *encoding)
{
char *date;
int namelen;
unsigned long time;
int tz;
const char *filler = " ";
if (fmt == CMIT_FMT_ONELINE)
return;
date = strchr(line, '>');
if (!date)
return;
namelen = ++date - line;
time = strtoul(date, &date, 10);
tz = strtol(date, NULL, 10);
if (fmt == CMIT_FMT_EMAIL) {
char *name_tail = strchr(line, '<');
int display_name_length;
if (!name_tail)
return;
while (line < name_tail && isspace(name_tail[-1]))
name_tail--;
display_name_length = name_tail - line;
filler = "";
strbuf_addstr(sb, "From: ");
add_rfc2047(sb, line, display_name_length, encoding);
strbuf_add(sb, name_tail, namelen - display_name_length);
strbuf_addch(sb, '\n');
} else {
strbuf_addf(sb, "%s: %.*s%.*s\n", what,
(fmt == CMIT_FMT_FULLER) ? 4 : 0,
filler, namelen, line);
}
switch (fmt) {
case CMIT_FMT_MEDIUM:
strbuf_addf(sb, "Date: %s\n", show_date(time, tz, dmode));
break;
case CMIT_FMT_EMAIL:
strbuf_addf(sb, "Date: %s\n", show_date(time, tz, DATE_RFC2822));
break;
case CMIT_FMT_FULLER:
strbuf_addf(sb, "%sDate: %s\n", what, show_date(time, tz, dmode));
break;
default:
/* notin' */
break;
}
}
开发者ID:Pistos,项目名称:git,代码行数:52,代码来源:pretty.c
示例4: main
int main(int argc, char **argv) {
int opt;
//struct timeval tv;
getopt_init();
while (-1 != (opt = getopt(argc, argv, "hs:"))) {
printf("\n");
switch (opt) {
case 'h': /* show help */
print_usage();
break;
case 's': /* set date*/
set_date(argv[2]);
break;
default:
break;
}
}
/* show date and kernel time */
if (argc == 1) {
show_date();
//ktime_get_timeval(&tv);
//printf("ktime_get_timeval %d:%d (s:ms)\n", (int)tv.tv_sec, (int)tv.tv_usec/1000);
return 0;
}
check_format(argv[argc-1]);
return 0;
}
开发者ID:AleksandraButrova,项目名称:embox,代码行数:31,代码来源:date.c
示例5: strbuf_reset
static const char *format_time(timestamp_t time, const char *tz_str,
int show_raw_time)
{
static struct strbuf time_buf = STRBUF_INIT;
strbuf_reset(&time_buf);
if (show_raw_time) {
strbuf_addf(&time_buf, "%"PRItime" %s", time, tz_str);
}
else {
const char *time_str;
size_t time_width;
int tz;
tz = atoi(tz_str);
time_str = show_date(time, tz, &blame_date_mode);
strbuf_addstr(&time_buf, time_str);
/*
* Add space paddings to time_buf to display a fixed width
* string, and use time_width for display width calibration.
*/
for (time_width = utf8_strwidth(time_str);
time_width < blame_date_width;
time_width++)
strbuf_addch(&time_buf, ' ');
}
return time_buf.buf;
}
开发者ID:ayanmw,项目名称:git,代码行数:27,代码来源:blame.c
示例6: save_dc
static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer *dc)
{
put_format(b, " <divecomputer");
show_utf8(b, dc->model, " model='", "'", 1);
if (dc->deviceid)
put_format(b, " deviceid='%08x'", dc->deviceid);
if (dc->diveid)
put_format(b, " diveid='%08x'", dc->diveid);
if (dc->when && dc->when != dive->when)
show_date(b, dc->when);
if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds)
put_duration(b, dc->duration, " duration='", " min'");
if (dc->divemode != OC) {
for (enum dive_comp_type i = 0; i < NUM_DC_TYPE; i++)
if (dc->divemode == i)
show_utf8(b, divemode_text[i], " dctype='", "'", 1);
if (dc->no_o2sensors)
put_format(b," no_o2sensors='%d'", dc->no_o2sensors);
}
put_format(b, ">\n");
save_depths(b, dc);
save_temperatures(b, dc);
save_airpressure(b, dc);
save_salinity(b, dc);
put_duration(b, dc->surfacetime, " <surfacetime>", " min</surfacetime>\n");
save_extra_data(b, dc->extra_data);
save_events(b, dc->events);
save_samples(b, dc->samples, dc->sample);
put_format(b, " </divecomputer>\n");
}
开发者ID:pidancier,项目名称:subsurface,代码行数:31,代码来源:save-xml.c
示例7: save_one_dive_to_mb
void save_one_dive_to_mb(struct membuffer *b, struct dive *dive)
{
struct divecomputer *dc;
put_string(b, "<dive");
if (dive->number)
put_format(b, " number='%d'", dive->number);
if (dive->tripflag == NO_TRIP)
put_format(b, " tripflag='NOTRIP'");
if (dive->rating)
put_format(b, " rating='%d'", dive->rating);
if (dive->visibility)
put_format(b, " visibility='%d'", dive->visibility);
save_tags(b, dive->tag_list);
if (dive->dive_site_uuid)
put_format(b, " divesiteid='%8x'", dive->dive_site_uuid);
show_date(b, dive->when);
put_format(b, " duration='%u:%02u min'>\n",
FRACTION(dive->dc.duration.seconds, 60));
save_overview(b, dive);
save_cylinder_info(b, dive);
save_weightsystem_info(b, dive);
save_dive_temperature(b, dive);
/* Save the dive computer data */
for_each_dc(dive, dc)
save_dc(b, dive, dc);
FOR_EACH_PICTURE(dive)
save_picture(b, picture);
put_format(b, "</dive>\n");
}
开发者ID:pidancier,项目名称:subsurface,代码行数:30,代码来源:save-xml.c
示例8: get_reflog_selector
void get_reflog_selector(struct strbuf *sb,
struct reflog_walk_info *reflog_info,
const struct date_mode *dmode, int force_date,
int shorten)
{
struct commit_reflog *commit_reflog = reflog_info->last_commit_reflog;
struct reflog_info *info;
const char *printed_ref;
if (!commit_reflog)
return;
if (shorten) {
if (!commit_reflog->reflogs->short_ref)
commit_reflog->reflogs->short_ref
= shorten_unambiguous_ref(commit_reflog->reflogs->ref, 0);
printed_ref = commit_reflog->reflogs->short_ref;
} else {
printed_ref = commit_reflog->reflogs->ref;
}
strbuf_addf(sb, "%[email protected]{", printed_ref);
if (commit_reflog->selector == SELECTOR_DATE ||
(commit_reflog->selector == SELECTOR_NONE && force_date)) {
info = &commit_reflog->reflogs->items[commit_reflog->recno+1];
strbuf_addstr(sb, show_date(info->timestamp, info->tz, dmode));
} else {
strbuf_addf(sb, "%d", commit_reflog->reflogs->nr
- 2 - commit_reflog->recno);
}
strbuf_addch(sb, '}');
}
开发者ID:basilgor,项目名称:git,代码行数:33,代码来源:reflog-walk.c
示例9: read_ref_at_ent
static int read_ref_at_ent(unsigned char *osha1, unsigned char *nsha1,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{
struct read_ref_at_cb *cb = cb_data;
cb->reccnt++;
cb->tz = tz;
cb->date = timestamp;
if (timestamp <= cb->at_time || cb->cnt == 0) {
if (cb->msg)
*cb->msg = xstrdup(message);
if (cb->cutoff_time)
*cb->cutoff_time = timestamp;
if (cb->cutoff_tz)
*cb->cutoff_tz = tz;
if (cb->cutoff_cnt)
*cb->cutoff_cnt = cb->reccnt - 1;
/*
* we have not yet updated cb->[n|o]sha1 so they still
* hold the values for the previous record.
*/
if (!is_null_sha1(cb->osha1)) {
hashcpy(cb->sha1, nsha1);
if (hashcmp(cb->osha1, nsha1))
warning("Log for ref %s has gap after %s.",
cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
}
else if (cb->date == cb->at_time)
hashcpy(cb->sha1, nsha1);
else if (hashcmp(nsha1, cb->sha1))
warning("Log for ref %s unexpectedly ended on %s.",
cb->refname, show_date(cb->date, cb->tz,
DATE_MODE(RFC2822)));
hashcpy(cb->osha1, osha1);
hashcpy(cb->nsha1, nsha1);
cb->found_it = 1;
return 1;
}
hashcpy(cb->osha1, osha1);
hashcpy(cb->nsha1, nsha1);
if (cb->cnt > 0)
cb->cnt--;
return 0;
}
开发者ID:chidveer,项目名称:git,代码行数:46,代码来源:refs.c
示例10: parse_approxidate
static void parse_approxidate(const char **argv, struct timeval *now)
{
for (; *argv; argv++) {
time_t t;
t = approxidate_relative(*argv, now);
printf("%s -> %s\n", *argv, show_date(t, 0, DATE_MODE(ISO8601)));
}
}
开发者ID:1tgr,项目名称:git,代码行数:8,代码来源:test-date.c
示例11: main
int main (int args, char *argv[])
{
if (wiringPiSetup () == -1)
exit (1) ;
int fd = lcdInit (2, 16, 4, RS, EN, D0,D1,D2,D3,D0,D1,D2,D3) ;
if (fd == -1)
{
printf ("lcdInit 1 failed\n") ;
return 1 ;
}
sleep (1) ; //显示屏初始化
lcdPosition (fd, 0, 0); lcdPuts (fd, " Raspberry Pi!"); //启动信息
sleep(1);
if(argv[1])
{
lcdPosition (fd, 0, 0) ;
lcdPuts (fd, " ") ; //清空第一行
lcdPosition (fd, 0, 0) ; lcdPuts (fd, argv[1]) ; //命令行参数显示至第一行
}
int start,now;
while(1)
{
show_date(fd);
cls(fd);
show_sys_info(fd);
sleep(5);
cls(fd);
start = show_run_time(fd);
while(now - start < 5){
now = show_run_time(fd);
sleep(1);
}
cls(fd);
show_net_info(fd);
sleep(5);
cls(fd);
show_client_count(fd);
sleep(3);
cls(fd);
show_client_info(fd);
cls(fd);
show_temp(fd);
sleep(5);
cls(fd);
}
return 0;
}
开发者ID:ustbgaofan,项目名称:pi-1602-with-DVK511,代码行数:58,代码来源:1602.c
示例12: switch
int myDate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QLCDNumber::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: show_date(); break;
default: ;
}
_id -= 1;
}
return _id;
}
开发者ID:wangjianfei,项目名称:Tony_high_C,代码行数:14,代码来源:moc_date.cpp
示例13: parse_dates
static void parse_dates(char **argv, struct timeval *now)
{
for (; *argv; argv++) {
char result[100];
unsigned long t;
int tz;
result[0] = 0;
parse_date(*argv, result, sizeof(result));
if (sscanf(result, "%lu %d", &t, &tz) == 2)
printf("%s -> %s\n",
*argv, show_date(t, tz, DATE_ISO8601));
else
printf("%s -> bad\n", *argv);
}
}
开发者ID:777,项目名称:test-proj,代码行数:16,代码来源:test-date.c
示例14: show_widget
static int
show_widget (CmdConfig *cmd_config, CameraWidget *widget)
{
CameraWidget *parent;
CameraWidgetType type;
CHECK (gp_widget_get_type (widget, &type));
switch (type) {
case GP_WIDGET_WINDOW:
case GP_WIDGET_SECTION:
CHECK (show_section (cmd_config, widget));
break;
case GP_WIDGET_DATE:
CHECK (show_date (cmd_config, widget));
CHECK (show_time (cmd_config, widget));
CHECK (gp_widget_get_parent (widget, &parent));
CHECK (show_widget (cmd_config, parent));
break;
case GP_WIDGET_MENU:
case GP_WIDGET_RADIO:
CHECK (show_radio (cmd_config, widget));
CHECK (gp_widget_get_parent (widget, &parent));
CHECK (show_widget (cmd_config, parent));
break;
case GP_WIDGET_RANGE:
CHECK (show_range (cmd_config, widget));
CHECK (gp_widget_get_parent (widget, &parent));
CHECK (show_widget (cmd_config, parent));
break;
case GP_WIDGET_TEXT:
CHECK (show_text (cmd_config, widget));
CHECK (gp_widget_get_parent (widget, &parent));
CHECK (show_widget (cmd_config, parent));
break;
case GP_WIDGET_TOGGLE:
CHECK (show_toggle (cmd_config, widget));
CHECK (gp_widget_get_parent (widget, &parent));
CHECK (show_widget (cmd_config, parent));
break;
default:
return (GP_ERROR_NOT_SUPPORTED);
}
return (GP_OK);
}
开发者ID:JohnChu,项目名称:Snoopy,代码行数:45,代码来源:gphoto2-cmd-config.c
示例15: parse_dates
static void parse_dates(const char **argv, struct timeval *now)
{
struct strbuf result = STRBUF_INIT;
for (; *argv; argv++) {
unsigned long t;
int tz;
strbuf_reset(&result);
parse_date(*argv, &result);
if (sscanf(result.buf, "%lu %d", &t, &tz) == 2)
printf("%s -> %s\n",
*argv, show_date(t, tz, DATE_MODE(ISO8601)));
else
printf("%s -> bad\n", *argv);
}
strbuf_release(&result);
}
开发者ID:1tgr,项目名称:git,代码行数:18,代码来源:test-date.c
示例16: strtoul
const char *show_ident_date(const struct ident_split *ident,
enum date_mode mode)
{
unsigned long date = 0;
long tz = 0;
if (ident->date_begin && ident->date_end)
date = strtoul(ident->date_begin, NULL, 10);
if (date_overflows(date))
date = 0;
else {
if (ident->tz_begin && ident->tz_end)
tz = strtol(ident->tz_begin, NULL, 10);
if (tz >= INT_MAX || tz <= INT_MIN)
tz = 0;
}
return show_date(date, tz, mode);
}
开发者ID:CookieChen,项目名称:git,代码行数:18,代码来源:pretty.c
示例17: parse_timestamp
const char *show_ident_date(const struct ident_split *ident,
const struct date_mode *mode)
{
timestamp_t date = 0;
long tz = 0;
if (ident->date_begin && ident->date_end)
date = parse_timestamp(ident->date_begin, NULL, 10);
if (date_overflows(date))
date = 0;
else {
if (ident->tz_begin && ident->tz_end)
tz = strtol(ident->tz_begin, NULL, 10);
if (tz >= INT_MAX || tz <= INT_MIN)
tz = 0;
}
return show_date(date, tz, mode);
}
开发者ID:PEPE-coin,项目名称:git,代码行数:18,代码来源:pretty.c
示例18: show_tagger
static void show_tagger(char *buf, int len, struct rev_info *rev)
{
char *email_end, *p;
unsigned long date;
int tz;
email_end = memchr(buf, '>', len);
if (!email_end)
return;
p = ++email_end;
while (isspace(*p))
p++;
date = strtoul(p, &p, 10);
while (isspace(*p))
p++;
tz = (int)strtol(p, NULL, 10);
printf("Tagger: %.*s\nDate: %s\n", (int)(email_end - buf), buf,
show_date(date, tz, rev->date_mode));
}
开发者ID:Inkdit,项目名称:git,代码行数:19,代码来源:builtin-log.c
示例19: save_dc
static void save_dc(struct membuffer *b, struct dive *dive, struct divecomputer *dc)
{
show_utf8(b, "model ", dc->model, "\n");
if (dc->deviceid)
put_format(b, "deviceid %08x\n", dc->deviceid);
if (dc->diveid)
put_format(b, "diveid %08x\n", dc->diveid);
if (dc->when && dc->when != dive->when)
show_date(b, dc->when);
if (dc->duration.seconds && dc->duration.seconds != dive->dc.duration.seconds)
put_duration(b, dc->duration, "duration ", "min\n");
save_depths(b, dc);
save_temperatures(b, dc);
save_airpressure(b, dc);
save_salinity(b, dc);
put_duration(b, dc->surfacetime, "surfacetime ", "min\n");
save_events(b, dc->events);
save_samples(b, dc->samples, dc->sample);
}
开发者ID:ricardoaranha,项目名称:subsurface,代码行数:21,代码来源:save-git.c
示例20: show_dates
static void show_dates(const char **argv, const char *format)
{
struct date_mode mode;
parse_date_format(format, &mode);
for (; *argv; argv++) {
char *arg;
time_t t;
int tz;
/*
* Do not use our normal timestamp parsing here, as the point
* is to test the formatting code in isolation.
*/
t = strtol(*argv, &arg, 10);
while (*arg == ' ')
arg++;
tz = atoi(arg);
printf("%s -> %s\n", *argv, show_date(t, tz, &mode));
}
}
开发者ID:1tgr,项目名称:git,代码行数:22,代码来源:test-date.c
注:本文中的show_date函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论