Главная » Просмотр файлов » Стандарт языка Си С99 TC

Стандарт языка Си С99 TC (1113411), страница 63

Файл №1113411 Стандарт языка Си С99 TC (Стандарт языка Си С99 + TC) 63 страницаСтандарт языка Си С99 TC (1113411) страница 632019-04-24СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 63)

The original values of the tm_wdayand tm_yday components of the structure are ignored, and the original values of theother components are not restricted to the ranges indicated above.276) On successfulcompletion, the values of the tm_wday and tm_yday components of the structure areset appropriately, and the other components are set to represent the specified calendartime, but with their values forced to the ranges indicated above; the final value oftm_mday is not set until tm_mon and tm_year are determined.Returns3The mktime function returns the specified calendar time encoded as a value of typetime_t.

If the calendar time cannot be represented, the function returns the value(time_t)(-1).4EXAMPLEWhat day of the week is July 4, 2001?#include <stdio.h>#include <time.h>static const char *const wday[] = {"Sunday", "Monday", "Tuesday", "Wednesday","Thursday", "Friday", "Saturday", "-unknown-"};struct tm time_str;/* ... */276) Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially thatDaylight Saving Time, respectively, is or is not in effect for the specified time.

A negative valuecauses it to attempt to determine whether Daylight Saving Time is in effect for the specified time.340Library§7.23.2.3WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3time_str.tm_year= 2001 - 1900;time_str.tm_mon= 7 - 1;time_str.tm_mday= 4;time_str.tm_hour= 0;time_str.tm_min= 0;time_str.tm_sec= 1;time_str.tm_isdst = -1;if (mktime(&time_str) == (time_t)(-1))time_str.tm_wday = 7;printf("%s\n", wday[time_str.tm_wday]);7.23.2.4 The time functionSynopsis1#include <time.h>time_t time(time_t *timer);Description2The time function determines the current calendar time.

The encoding of the value isunspecified.Returns3The time function returns the implementation’s best approximation to the currentcalendar time. The value (time_t)(-1) is returned if the calendar time is notavailable. If timer is not a null pointer, the return value is also assigned to the object itpoints to.7.23.3 Time conversion functions1Except for the strftime function, these functions each return a pointer to one of twotypes of static objects: a broken-down time structure or an array of char.

Execution ofany of the functions that return a pointer to one of these object types may overwrite theinformation in any object of the same type pointed to by the value returned from anyprevious call to any of them. The implementation shall behave as if no other libraryfunctions call these functions.7.23.3.1 The asctime functionSynopsis1#include <time.h>char *asctime(const struct tm *timeptr);Description2The asctime function converts the broken-down time in the structure pointed to bytimeptr into a string in the formSun Sep 16 01:03:52 1973\n\0§7.23.3.1Library341ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256using the equivalent of the following algorithm.char *asctime(const struct tm *timeptr){static const char wday_name[7][3] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};static const char mon_name[12][3] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};static char result[26];sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",wday_name[timeptr->tm_wday],mon_name[timeptr->tm_mon],timeptr->tm_mday, timeptr->tm_hour,timeptr->tm_min, timeptr->tm_sec,1900 + timeptr->tm_year);return result;}Returns3The asctime function returns a pointer to the string.7.23.3.2 The ctime functionSynopsis1#include <time.h>char *ctime(const time_t *timer);Description2The ctime function converts the calendar time pointed to by timer to local time in theform of a string.

It is equivalent toasctime(localtime(timer))Returns3The ctime function returns the pointer returned by the asctime function with thatbroken-down time as argument.Forward references: the localtime function (7.23.3.4).342Library§7.23.3.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.23.3.3 The gmtime functionSynopsis1#include <time.h>struct tm *gmtime(const time_t *timer);Description2The gmtime function converts the calendar time pointed to by timer into a brokendown time, expressed as UTC.Returns3The gmtime function returns a pointer to the broken-down time, or a null pointer if thespecified time cannot be converted to UTC.7.23.3.4 The localtime functionSynopsis1#include <time.h>struct tm *localtime(const time_t *timer);Description2The localtime function converts the calendar time pointed to by timer into abroken-down time, expressed as local time.Returns3The localtime function returns a pointer to the broken-down time, or a null pointer ifthe specified time cannot be converted to local time.7.23.3.5 The strftime functionSynopsis1#include <time.h>size_t strftime(char * restrict s,size_t maxsize,const char * restrict format,const struct tm * restrict timeptr);Description2The strftime function places characters into the array pointed to by s as controlled bythe string pointed to by format.

The format shall be a multibyte character sequence,beginning and ending in its initial shift state. The format string consists of zero ormore conversion specifiers and ordinary multibyte characters. A conversion specifierconsists of a % character, possibly followed by an E or O modifier character (describedbelow), followed by a character that determines the behavior of the conversion specifier.All ordinary multibyte characters (including the terminating null character) are copied§7.23.3.5Library343ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256unchanged into the array. If copying takes place between objects that overlap, thebehavior is undefined.

No more than maxsize characters are placed into the array.3Each conversion specifier is replaced by appropriate characters as described in thefollowing list. The appropriate characters are determined using the LC_TIME categoryof the current locale and by the values of zero or more members of the broken-down timestructure pointed to by timeptr, as specified in brackets in the description. If any ofthe specified values is outside the normal range, the characters stored are unspecified.%a%A%b%B%c%C%d%D%e%F%g%G%h%H%I%j%m%M%n%p%r%R%S%t%T344is replaced by the locale’s abbreviated weekday name. [tm_wday]is replaced by the locale’s full weekday name.

[tm_wday]is replaced by the locale’s abbreviated month name. [tm_mon]is replaced by the locale’s full month name. [tm_mon]is replaced by the locale’s appropriate date and time representation. [all specifiedin 7.23.1]is replaced by the year divided by 100 and truncated to an integer, as a decimalnumber (00−99). [tm_year]is replaced by the day of the month as a decimal number (01−31). [tm_mday]is equivalent to ‘‘%m/%d/%y’’. [tm_mon, tm_mday, tm_year]is replaced by the day of the month as a decimal number (1−31); a single digit ispreceded by a space. [tm_mday]is equivalent to ‘‘%Y−%m−%d’’ (the ISO 8601 date format).

[tm_year, tm_mon,tm_mday]is replaced by the last 2 digits of the week-based year (see below) as a decimalnumber (00−99). [tm_year, tm_wday, tm_yday]is replaced by the week-based year (see below) as a decimal number (e.g., 1997).[tm_year, tm_wday, tm_yday]is equivalent to ‘‘%b’’. [tm_mon]is replaced by the hour (24-hour clock) as a decimal number (00−23).

[tm_hour]is replaced by the hour (12-hour clock) as a decimal number (01−12). [tm_hour]is replaced by the day of the year as a decimal number (001−366). [tm_yday]is replaced by the month as a decimal number (01−12). [tm_mon]is replaced by the minute as a decimal number (00−59). [tm_min]is replaced by a new-line character.is replaced by the locale’s equivalent of the AM/PM designations associated with a12-hour clock. [tm_hour]is replaced by the locale’s 12-hour clock time. [tm_hour, tm_min, tm_sec]is equivalent to ‘‘%H:%M’’.

[tm_hour, tm_min]is replaced by the second as a decimal number (00−60). [tm_sec]is replaced by a horizontal-tab character.is equivalent to ‘‘%H:%M:%S’’ (the ISO 8601 time format). [tm_hour, tm_min,tm_sec]Library§7.23.3.5WG14/N1256%u%U%V%w%W%x%X%y%Y%z%Z%%4Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3is replaced by the ISO 8601 weekday as a decimal number (1−7), where Mondayis 1. [tm_wday]is replaced by the week number of the year (the first Sunday as the first day of week1) as a decimal number (00−53). [tm_year, tm_wday, tm_yday]is replaced by the ISO 8601 week number (see below) as a decimal number(01−53). [tm_year, tm_wday, tm_yday]is replaced by the weekday as a decimal number (0−6), where Sunday is 0.[tm_wday]is replaced by the week number of the year (the first Monday as the first day ofweek 1) as a decimal number (00−53).

[tm_year, tm_wday, tm_yday]is replaced by the locale’s appropriate date representation. [all specified in 7.23.1]is replaced by the locale’s appropriate time representation. [all specified in 7.23.1]is replaced by the last 2 digits of the year as a decimal number (00−99).[tm_year]is replaced by the year as a decimal number (e.g., 1997). [tm_year]is replaced by the offset from UTC in the ISO 8601 format ‘‘−0430’’ (meaning 4hours 30 minutes behind UTC, west of Greenwich), or by no characters if no timezone is determinable.

[tm_isdst]is replaced by the locale’s time zone name or abbreviation, or by no characters if notime zone is determinable. [tm_isdst]is replaced by %.Some conversion specifiers can be modified by the inclusion of an E or O modifiercharacter to indicate an alternative format or specification.

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
А знаете ли Вы, что из года в год задания практически не меняются? Математика, преподаваемая в учебных заведениях, никак не менялась минимум 30 лет. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6418
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее