~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/item_timefunc.cc

  • Committer: Brian Aker
  • Date: 2008-07-13 22:45:08 UTC
  • Revision ID: brian@tangent.org-20080713224508-hb20z4okblotb39a
longlong replacement

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
    0                otherwise
182
182
*/
183
183
  
184
 
static bool sec_to_time(longlong seconds, bool unsigned_flag, MYSQL_TIME *ltime)
 
184
static bool sec_to_time(int64_t seconds, bool unsigned_flag, MYSQL_TIME *ltime)
185
185
{
186
186
  uint sec;
187
187
 
212
212
  ltime->second= TIME_MAX_SECOND;
213
213
 
214
214
  char buf[22];
215
 
  int len= (int)(longlong10_to_str(seconds, buf, unsigned_flag ? 10 : -10)
 
215
  int len= (int)(int64_t10_to_str(seconds, buf, unsigned_flag ? 10 : -10)
216
216
                 - buf);
217
217
  make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
218
218
                               buf, len, MYSQL_TIMESTAMP_TIME,
868
868
 
869
869
  for (i=0 ; i < count ; i++)
870
870
  {
871
 
    longlong value;
 
871
    int64_t value;
872
872
    const char *start= str;
873
873
    for (value=0; str != end && my_isdigit(cs,*str) ; str++)
874
 
      value= value * 10LL + (longlong) (*str - '0');
 
874
      value= value * 10LL + (int64_t) (*str - '0');
875
875
    if (transform_msec && i == count - 1) // microseconds always last
876
876
    {
877
877
      long msec_length= 6 - (str - start);
895
895
}
896
896
 
897
897
 
898
 
longlong Item_func_period_add::val_int()
 
898
int64_t Item_func_period_add::val_int()
899
899
{
900
900
  assert(fixed == 1);
901
901
  ulong period=(ulong) args[0]->val_int();
904
904
  if ((null_value=args[0]->null_value || args[1]->null_value) ||
905
905
      period == 0L)
906
906
    return 0; /* purecov: inspected */
907
 
  return (longlong)
 
907
  return (int64_t)
908
908
    convert_month_to_period((uint) ((int) convert_period_to_month(period)+
909
909
                                    months));
910
910
}
911
911
 
912
912
 
913
 
longlong Item_func_period_diff::val_int()
 
913
int64_t Item_func_period_diff::val_int()
914
914
{
915
915
  assert(fixed == 1);
916
916
  ulong period1=(ulong) args[0]->val_int();
918
918
 
919
919
  if ((null_value=args[0]->null_value || args[1]->null_value))
920
920
    return 0; /* purecov: inspected */
921
 
  return (longlong) ((long) convert_period_to_month(period1)-
 
921
  return (int64_t) ((long) convert_period_to_month(period1)-
922
922
                     (long) convert_period_to_month(period2));
923
923
}
924
924
 
925
925
 
926
926
 
927
 
longlong Item_func_to_days::val_int()
 
927
int64_t Item_func_to_days::val_int()
928
928
{
929
929
  assert(fixed == 1);
930
930
  MYSQL_TIME ltime;
931
931
  if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
932
932
    return 0;
933
 
  return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
 
933
  return (int64_t) calc_daynr(ltime.year,ltime.month,ltime.day);
934
934
}
935
935
 
936
936
 
961
961
}
962
962
 
963
963
 
964
 
longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
 
964
int64_t Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp)
965
965
{
966
966
  assert(fixed == 1);
967
967
  MYSQL_TIME ltime;
968
 
  longlong res;
 
968
  int64_t res;
969
969
  if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
970
970
  {
971
971
    /* got NULL, leave the incl_endp intact */
972
972
    return LONGLONG_MIN;
973
973
  }
974
 
  res=(longlong) calc_daynr(ltime.year,ltime.month,ltime.day);
 
974
  res=(int64_t) calc_daynr(ltime.year,ltime.month,ltime.day);
975
975
  
976
976
  if (args[0]->field_type() == MYSQL_TYPE_NEWDATE)
977
977
  {
999
999
}
1000
1000
 
1001
1001
 
1002
 
longlong Item_func_dayofyear::val_int()
 
1002
int64_t Item_func_dayofyear::val_int()
1003
1003
{
1004
1004
  assert(fixed == 1);
1005
1005
  MYSQL_TIME ltime;
1006
1006
  if (get_arg0_date(&ltime,TIME_NO_ZERO_DATE))
1007
1007
    return 0;
1008
 
  return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day) -
 
1008
  return (int64_t) calc_daynr(ltime.year,ltime.month,ltime.day) -
1009
1009
    calc_daynr(ltime.year,1,1) + 1;
1010
1010
}
1011
1011
 
1012
 
longlong Item_func_dayofmonth::val_int()
 
1012
int64_t Item_func_dayofmonth::val_int()
1013
1013
{
1014
1014
  assert(fixed == 1);
1015
1015
  MYSQL_TIME ltime;
1016
1016
  (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
1017
 
  return (longlong) ltime.day;
 
1017
  return (int64_t) ltime.day;
1018
1018
}
1019
1019
 
1020
 
longlong Item_func_month::val_int()
 
1020
int64_t Item_func_month::val_int()
1021
1021
{
1022
1022
  assert(fixed == 1);
1023
1023
  MYSQL_TIME ltime;
1024
1024
  (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
1025
 
  return (longlong) ltime.month;
 
1025
  return (int64_t) ltime.month;
1026
1026
}
1027
1027
 
1028
1028
 
1049
1049
  Returns the quarter of the year.
1050
1050
*/
1051
1051
 
1052
 
longlong Item_func_quarter::val_int()
 
1052
int64_t Item_func_quarter::val_int()
1053
1053
{
1054
1054
  assert(fixed == 1);
1055
1055
  MYSQL_TIME ltime;
1056
1056
  if (get_arg0_date(&ltime, TIME_FUZZY_DATE))
1057
1057
    return 0;
1058
 
  return (longlong) ((ltime.month+2)/3);
 
1058
  return (int64_t) ((ltime.month+2)/3);
1059
1059
}
1060
1060
 
1061
 
longlong Item_func_hour::val_int()
 
1061
int64_t Item_func_hour::val_int()
1062
1062
{
1063
1063
  assert(fixed == 1);
1064
1064
  MYSQL_TIME ltime;
1066
1066
  return ltime.hour;
1067
1067
}
1068
1068
 
1069
 
longlong Item_func_minute::val_int()
 
1069
int64_t Item_func_minute::val_int()
1070
1070
{
1071
1071
  assert(fixed == 1);
1072
1072
  MYSQL_TIME ltime;
1077
1077
/**
1078
1078
  Returns the second in time_exp in the range of 0 - 59.
1079
1079
*/
1080
 
longlong Item_func_second::val_int()
 
1080
int64_t Item_func_second::val_int()
1081
1081
{
1082
1082
  assert(fixed == 1);
1083
1083
  MYSQL_TIME ltime;
1125
1125
 @endverbatim
1126
1126
*/
1127
1127
 
1128
 
longlong Item_func_week::val_int()
 
1128
int64_t Item_func_week::val_int()
1129
1129
{
1130
1130
  assert(fixed == 1);
1131
1131
  uint year;
1132
1132
  MYSQL_TIME ltime;
1133
1133
  if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
1134
1134
    return 0;
1135
 
  return (longlong) calc_week(&ltime,
 
1135
  return (int64_t) calc_week(&ltime,
1136
1136
                              week_mode((uint) args[1]->val_int()),
1137
1137
                              &year);
1138
1138
}
1139
1139
 
1140
1140
 
1141
 
longlong Item_func_yearweek::val_int()
 
1141
int64_t Item_func_yearweek::val_int()
1142
1142
{
1143
1143
  assert(fixed == 1);
1144
1144
  uint year,week;
1152
1152
}
1153
1153
 
1154
1154
 
1155
 
longlong Item_func_weekday::val_int()
 
1155
int64_t Item_func_weekday::val_int()
1156
1156
{
1157
1157
  assert(fixed == 1);
1158
1158
  MYSQL_TIME ltime;
1160
1160
  if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE))
1161
1161
    return 0;
1162
1162
 
1163
 
  return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month,
 
1163
  return (int64_t) calc_weekday(calc_daynr(ltime.year, ltime.month,
1164
1164
                                            ltime.day),
1165
1165
                                 odbc_type) + test(odbc_type);
1166
1166
}
1182
1182
}
1183
1183
 
1184
1184
 
1185
 
longlong Item_func_year::val_int()
 
1185
int64_t Item_func_year::val_int()
1186
1186
{
1187
1187
  assert(fixed == 1);
1188
1188
  MYSQL_TIME ltime;
1189
1189
  (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
1190
 
  return (longlong) ltime.year;
 
1190
  return (int64_t) ltime.year;
1191
1191
}
1192
1192
 
1193
1193
 
1215
1215
}
1216
1216
 
1217
1217
 
1218
 
longlong Item_func_year::val_int_endpoint(bool left_endp, bool *incl_endp)
 
1218
int64_t Item_func_year::val_int_endpoint(bool left_endp, bool *incl_endp)
1219
1219
{
1220
1220
  assert(fixed == 1);
1221
1221
  MYSQL_TIME ltime;
1245
1245
}
1246
1246
 
1247
1247
 
1248
 
longlong Item_func_unix_timestamp::val_int()
 
1248
int64_t Item_func_unix_timestamp::val_int()
1249
1249
{
1250
1250
  MYSQL_TIME ltime;
1251
1251
  bool not_used;
1252
1252
  
1253
1253
  assert(fixed == 1);
1254
1254
  if (arg_count == 0)
1255
 
    return (longlong) current_thd->query_start();
 
1255
    return (int64_t) current_thd->query_start();
1256
1256
  if (args[0]->type() == FIELD_ITEM)
1257
1257
  {                                             // Optimize timestamp field
1258
1258
    Field *field=((Item_field*) args[0])->field;
1271
1271
    return 0;
1272
1272
  }
1273
1273
  
1274
 
  return (longlong) TIME_to_timestamp(current_thd, &ltime, &not_used);
 
1274
  return (int64_t) TIME_to_timestamp(current_thd, &ltime, &not_used);
1275
1275
}
1276
1276
 
1277
1277
 
1278
 
longlong Item_func_time_to_sec::val_int()
 
1278
int64_t Item_func_time_to_sec::val_int()
1279
1279
{
1280
1280
  assert(fixed == 1);
1281
1281
  MYSQL_TIME ltime;
1282
 
  longlong seconds;
 
1282
  int64_t seconds;
1283
1283
  (void) get_arg0_time(&ltime);
1284
1284
  seconds=ltime.hour*3600L+ltime.minute*60+ltime.second;
1285
1285
  return ltime.neg ? -seconds : seconds;
1296
1296
                               String *str_value, INTERVAL *interval)
1297
1297
{
1298
1298
  uint64_t array[5];
1299
 
  longlong value= 0;
 
1299
  int64_t value= 0;
1300
1300
  const char *str= NULL;
1301
1301
  size_t length= 0;
1302
1302
  CHARSET_INFO *cs=str_value->charset();
1460
1460
}
1461
1461
 
1462
1462
 
1463
 
longlong Item_date::val_int()
 
1463
int64_t Item_date::val_int()
1464
1464
{
1465
1465
  assert(fixed == 1);
1466
1466
  MYSQL_TIME ltime;
1467
1467
  if (get_date(&ltime, TIME_FUZZY_DATE))
1468
1468
    return 0;
1469
 
  return (longlong) (ltime.year*10000L+ltime.month*100+ltime.day);
 
1469
  return (int64_t) (ltime.year*10000L+ltime.month*100+ltime.day);
1470
1470
}
1471
1471
 
1472
1472
 
1473
1473
bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date __attribute__((__unused__)))
1474
1474
{
1475
 
  longlong value=args[0]->val_int();
 
1475
  int64_t value=args[0]->val_int();
1476
1476
  if ((null_value=args[0]->null_value))
1477
1477
    return 1;
1478
1478
  bzero(ltime, sizeof(MYSQL_TIME));
1493
1493
  /* We don't need to set second_part and neg because they already 0 */
1494
1494
  ltime.hour= ltime.minute= ltime.second= 0;
1495
1495
  ltime.time_type= MYSQL_TIMESTAMP_DATE;
1496
 
  value= (longlong) TIME_to_uint64_t_date(&ltime);
 
1496
  value= (int64_t) TIME_to_uint64_t_date(&ltime);
1497
1497
}
1498
1498
 
1499
1499
String *Item_func_curdate::val_str(String *str)
1607
1607
  collation.set(&my_charset_bin);
1608
1608
 
1609
1609
  store_now_in_TIME(&ltime);
1610
 
  value= (longlong) TIME_to_uint64_t_datetime(&ltime);
 
1610
  value= (int64_t) TIME_to_uint64_t_datetime(&ltime);
1611
1611
 
1612
1612
  buff_length= (uint) my_datetime_to_str(&ltime, buff);
1613
1613
  max_length= buff_length;
1679
1679
}
1680
1680
 
1681
1681
 
1682
 
longlong Item_func_sysdate_local::val_int()
 
1682
int64_t Item_func_sysdate_local::val_int()
1683
1683
{
1684
1684
  assert(fixed == 1);
1685
1685
  store_now_in_TIME(&ltime);
1686
 
  return (longlong) TIME_to_uint64_t_datetime(&ltime);
 
1686
  return (int64_t) TIME_to_uint64_t_datetime(&ltime);
1687
1687
}
1688
1688
 
1689
1689
 
1725
1725
{
1726
1726
  assert(fixed == 1);
1727
1727
  MYSQL_TIME ltime;
1728
 
  longlong arg_val= args[0]->val_int(); 
 
1728
  int64_t arg_val= args[0]->val_int(); 
1729
1729
 
1730
1730
  if ((null_value=args[0]->null_value) ||
1731
1731
      str->alloc(MAX_DATE_STRING_REP_LENGTH))
1741
1741
}
1742
1742
 
1743
1743
 
1744
 
longlong Item_func_sec_to_time::val_int()
 
1744
int64_t Item_func_sec_to_time::val_int()
1745
1745
{
1746
1746
  assert(fixed == 1);
1747
1747
  MYSQL_TIME ltime;
1748
 
  longlong arg_val= args[0]->val_int(); 
 
1748
  int64_t arg_val= args[0]->val_int(); 
1749
1749
  
1750
1750
  if ((null_value=args[0]->null_value))
1751
1751
    return 0;
1976
1976
}
1977
1977
 
1978
1978
 
1979
 
longlong Item_func_from_unixtime::val_int()
 
1979
int64_t Item_func_from_unixtime::val_int()
1980
1980
{
1981
1981
  MYSQL_TIME time_tmp;
1982
1982
 
1985
1985
  if (get_date(&time_tmp, 0))
1986
1986
    return 0;
1987
1987
 
1988
 
  return (longlong) TIME_to_uint64_t_datetime(&time_tmp);
 
1988
  return (int64_t) TIME_to_uint64_t_datetime(&time_tmp);
1989
1989
}
1990
1990
 
1991
1991
bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime,
2083
2083
}
2084
2084
 
2085
2085
 
2086
 
longlong Item_date_add_interval::val_int()
 
2086
int64_t Item_date_add_interval::val_int()
2087
2087
{
2088
2088
  assert(fixed == 1);
2089
2089
  MYSQL_TIME ltime;
2090
 
  longlong date;
 
2090
  int64_t date;
2091
2091
  if (Item_date_add_interval::get_date(&ltime, TIME_NO_ZERO_DATE))
2092
 
    return (longlong) 0;
 
2092
    return (int64_t) 0;
2093
2093
  date = (ltime.year*100L + ltime.month)*100L + ltime.day;
2094
2094
  return ltime.time_type == MYSQL_TIMESTAMP_DATE ? date :
2095
2095
    ((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second;
2173
2173
}
2174
2174
 
2175
2175
 
2176
 
longlong Item_extract::val_int()
 
2176
int64_t Item_extract::val_int()
2177
2177
{
2178
2178
  assert(fixed == 1);
2179
2179
  MYSQL_TIME ltime;
2212
2212
  case INTERVAL_DAY_MINUTE:     return (long) (ltime.day*10000L+
2213
2213
                                               ltime.hour*100L+
2214
2214
                                               ltime.minute)*neg;
2215
 
  case INTERVAL_DAY_SECOND:      return ((longlong) ltime.day*1000000L+
2216
 
                                         (longlong) (ltime.hour*10000L+
 
2215
  case INTERVAL_DAY_SECOND:      return ((int64_t) ltime.day*1000000L+
 
2216
                                         (int64_t) (ltime.hour*10000L+
2217
2217
                                                     ltime.minute*100+
2218
2218
                                                     ltime.second))*neg;
2219
2219
  case INTERVAL_HOUR:           return (long) ltime.hour*neg;
2224
2224
  case INTERVAL_MINUTE_SECOND:  return (long) (ltime.minute*100+ltime.second)*neg;
2225
2225
  case INTERVAL_SECOND:         return (long) ltime.second*neg;
2226
2226
  case INTERVAL_MICROSECOND:    return (long) ltime.second_part*neg;
2227
 
  case INTERVAL_DAY_MICROSECOND: return (((longlong)ltime.day*1000000L +
2228
 
                                          (longlong)ltime.hour*10000L +
 
2227
  case INTERVAL_DAY_MICROSECOND: return (((int64_t)ltime.day*1000000L +
 
2228
                                          (int64_t)ltime.hour*10000L +
2229
2229
                                          ltime.minute*100 +
2230
2230
                                          ltime.second)*1000000L +
2231
2231
                                         ltime.second_part)*neg;
2232
 
  case INTERVAL_HOUR_MICROSECOND: return (((longlong)ltime.hour*10000L +
 
2232
  case INTERVAL_HOUR_MICROSECOND: return (((int64_t)ltime.hour*10000L +
2233
2233
                                           ltime.minute*100 +
2234
2234
                                           ltime.second)*1000000L +
2235
2235
                                          ltime.second_part)*neg;
2236
 
  case INTERVAL_MINUTE_MICROSECOND: return (((longlong)(ltime.minute*100+
 
2236
  case INTERVAL_MINUTE_MICROSECOND: return (((int64_t)(ltime.minute*100+
2237
2237
                                                        ltime.second))*1000000L+
2238
2238
                                            ltime.second_part)*neg;
2239
 
  case INTERVAL_SECOND_MICROSECOND: return ((longlong)ltime.second*1000000L+
 
2239
  case INTERVAL_SECOND_MICROSECOND: return ((int64_t)ltime.second*1000000L+
2240
2240
                                            ltime.second_part)*neg;
2241
2241
  case INTERVAL_LAST: assert(0); break;  /* purecov: deadcode */
2242
2242
  }
2439
2439
}
2440
2440
 
2441
2441
 
2442
 
longlong Item_datetime_typecast::val_int()
 
2442
int64_t Item_datetime_typecast::val_int()
2443
2443
{
2444
2444
  assert(fixed == 1);
2445
2445
  MYSQL_TIME ltime;
2467
2467
}
2468
2468
 
2469
2469
 
2470
 
longlong Item_time_typecast::val_int()
 
2470
int64_t Item_time_typecast::val_int()
2471
2471
{
2472
2472
  MYSQL_TIME ltime;
2473
2473
  if (get_time(&ltime))
2525
2525
  return 0;
2526
2526
}
2527
2527
 
2528
 
longlong Item_date_typecast::val_int()
 
2528
int64_t Item_date_typecast::val_int()
2529
2529
{
2530
2530
  assert(fixed == 1);
2531
2531
  MYSQL_TIME ltime;
2532
2532
  if ((null_value= args[0]->get_date(&ltime, TIME_FUZZY_DATE)))
2533
2533
    return 0;
2534
 
  return (longlong) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
 
2534
  return (int64_t) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
2535
2535
}
2536
2536
 
2537
2537
/**
2587
2587
    for dates between 0000-01-01 and 0099-12-31
2588
2588
*/
2589
2589
 
2590
 
longlong Item_func_makedate::val_int()
 
2590
int64_t Item_func_makedate::val_int()
2591
2591
{
2592
2592
  assert(fixed == 1);
2593
2593
  MYSQL_TIME l_time;
2608
2608
  {
2609
2609
    null_value=0;
2610
2610
    get_date_from_daynr(days,&l_time.year,&l_time.month,&l_time.day);
2611
 
    return (longlong) (l_time.year * 10000L + l_time.month * 100 + l_time.day);
 
2611
    return (int64_t) (l_time.year * 10000L + l_time.month * 100 + l_time.day);
2612
2612
  }
2613
2613
 
2614
2614
err:
2660
2660
  MYSQL_TIME l_time1, l_time2, l_time3;
2661
2661
  bool is_time= 0;
2662
2662
  long days, microseconds;
2663
 
  longlong seconds;
 
2663
  int64_t seconds;
2664
2664
  int l_sign= sign;
2665
2665
 
2666
2666
  null_value=0;
2757
2757
String *Item_func_timediff::val_str(String *str)
2758
2758
{
2759
2759
  assert(fixed == 1);
2760
 
  longlong seconds;
 
2760
  int64_t seconds;
2761
2761
  long microseconds;
2762
2762
  int l_sign= 1;
2763
2763
  MYSQL_TIME l_time1 ,l_time2, l_time3;
2808
2808
  MYSQL_TIME ltime;
2809
2809
  bool overflow= 0;
2810
2810
 
2811
 
  longlong hour=   args[0]->val_int();
2812
 
  longlong minute= args[1]->val_int();
2813
 
  longlong second= args[2]->val_int();
 
2811
  int64_t hour=   args[0]->val_int();
 
2812
  int64_t minute= args[1]->val_int();
 
2813
  int64_t second= args[2]->val_int();
2814
2814
 
2815
2815
  if ((null_value=(args[0]->null_value || 
2816
2816
                   args[1]->null_value ||
2846
2846
    ltime.minute= TIME_MAX_MINUTE;
2847
2847
    ltime.second= TIME_MAX_SECOND;
2848
2848
    char buf[28];
2849
 
    char *ptr= longlong10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
 
2849
    char *ptr= int64_t10_to_str(hour, buf, args[0]->unsigned_flag ? 10 : -10);
2850
2850
    int len = (int)(ptr - buf) +
2851
2851
      my_sprintf(ptr, (ptr, ":%02u:%02u", (uint)minute, (uint)second));
2852
2852
    make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
2871
2871
  Result: int value
2872
2872
*/
2873
2873
 
2874
 
longlong Item_func_microsecond::val_int()
 
2874
int64_t Item_func_microsecond::val_int()
2875
2875
{
2876
2876
  assert(fixed == 1);
2877
2877
  MYSQL_TIME ltime;
2881
2881
}
2882
2882
 
2883
2883
 
2884
 
longlong Item_func_timestamp_diff::val_int()
 
2884
int64_t Item_func_timestamp_diff::val_int()
2885
2885
{
2886
2886
  MYSQL_TIME ltime1, ltime2;
2887
 
  longlong seconds;
 
2887
  int64_t seconds;
2888
2888
  long microseconds;
2889
2889
  long months= 0;
2890
2890
  int neg= 1;
2973
2973
  case INTERVAL_MICROSECOND:
2974
2974
    /*
2975
2975
      In MySQL difference between any two valid datetime values
2976
 
      in microseconds fits into longlong.
 
2976
      in microseconds fits into int64_t.
2977
2977
    */
2978
2978
    return (seconds*1000000L+microseconds)*neg;
2979
2979
  default: